Skip to content

feat(cdk): switch injectables to new scope API - #10301

Merged
andrewseguin merged 5 commits into
angular:masterfrom
jelbourn:cdk-tree-shakable-services
Mar 19, 2018
Merged

andrewseguin merged 5 commits into
angular:masterfrom
jelbourn:cdk-tree-shakable-services

Conversation

@jelbourn

@jelbourn jelbourn commented Mar 7, 2018

Copy link
Copy Markdown
Contributor

No description provided.

@jelbourn jelbourn added pr: needs review target: major This PR is targeted for the next major release labels Mar 7, 2018
@jelbourn
jelbourn requested review from alxhub and mmalerba March 7, 2018 01:15
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Mar 7, 2018
Comment thread src/cdk/overlay/overlay-directives.ts Outdated
};

new InjectionToken<() => ScrollStrategy>('cdk-connected-overlay-scroll-strategy', {
scope: APP_ROOT_SCOPE,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@NgModule({
providers: [Platform]
})
@NgModule()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, will we be able to kill this module off in the future? It appears to do nothing now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose so for now, though we could add other stuff to it. Maybe something like
*cdkIfPlatform="IE11, Safari"

FocusTrapFactory,
AriaDescriber,
LIVE_ANNOUNCER_PROVIDER,
ARIA_DESCRIBER_PROVIDER,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super familiar with how the app-wide providers work yet, but should the AriaDescriber still be set in the providers in this case? I believe that it's the only reason why, for example, the tooltip imports the A11yModule.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it, module imports just for this kind of injectable shouldn't be necessary any more. I'll address those in my next PR that applies this to material.

*
* @docs-private
*/
export const DIR_DOCUMENT = new InjectionToken<Document>('cdk-dir-doc', {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an aside, do we really need a separate token for the document here? We can easily stub out the DOCUMENT itself in the tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was originally doing this I found that re-providing common's DOCUMENT with something else made Angular not work.

@jelbourn
jelbourn force-pushed the cdk-tree-shakable-services branch 2 times, most recently from 52b092f to 60e63ea Compare March 8, 2018 00:36
@jelbourn

jelbourn commented Mar 8, 2018

Copy link
Copy Markdown
Contributor Author

I've re-added the old providers because some people were depending on them

@crisbeto crisbeto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn
jelbourn force-pushed the cdk-tree-shakable-services branch 3 times, most recently from bea96c7 to c5b785a Compare March 16, 2018 00:21
@jelbourn
jelbourn force-pushed the cdk-tree-shakable-services branch from c5b785a to 5a334d7 Compare March 16, 2018 17:39
@jelbourn
jelbourn force-pushed the cdk-tree-shakable-services branch from fdafeb4 to aae7243 Compare March 19, 2018 16:58
@andrewseguin andrewseguin added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Mar 19, 2018
@andrewseguin
andrewseguin merged commit 6405da9 into angular:master Mar 19, 2018
@jelbourn
jelbourn deleted the cdk-tree-shakable-services branch April 2, 2018 22:32
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants