Skip to content

APP_ROOT_SCOPE token #22185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

APP_ROOT_SCOPE token #22185

wants to merge 1 commit into from

Conversation

alxhub
Copy link
Member

@alxhub alxhub commented Feb 12, 2018

No description provided.

@mary-poppins
Copy link

You can preview 8287550 at https://pr22185-8287550.ngbuilds.io/.

// APP_ROOT_SCOPE is cast as a Type to allow for its usage as the scope parameter of @Injectable().

/**
* A scope which targets the root injector.
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be part of public API and needs a richer documentation with an example.

Copy link
Member Author

Choose a reason for hiding this comment

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

Documented.

*
* @experimental
*/
export const APP_ROOT_SCOPE: Type<any> = new InjectionToken<boolean>(
Copy link
Member

Choose a reason for hiding this comment

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

Ho, ho! Look who's back from the dead!

scope-undead

@mary-poppins
Copy link

You can preview eb6fa00 at https://pr22185-eb6fa00.ngbuilds.io/.

@alxhub alxhub added the target: major This PR is targeted for the next major release label Feb 13, 2018
@mary-poppins
Copy link

You can preview fbaf7ad at https://pr22185-fbaf7ad.ngbuilds.io/.

@Injectable() supports a scope parameter which specifies the target module.
However, it's still difficult to specify that a particular service belongs
in the root injector. A developer attempting to ensure that must either
also provide a module intended for placement in the root injector or target
a module known to already be in the root injector (e.g. BrowserModule).
Both of these strategies are cumbersome and brittle.

Instead, this commit adds a token APP_ROOT_SCOPE which provides a
straightforward way of targeting the root injector directly, without
requiring special knowledge of modules within it.
@mary-poppins
Copy link

You can preview f57afca at https://pr22185-f57afca.ngbuilds.io/.

@alxhub alxhub added the action: merge The PR is ready for merge by the caretaker label Feb 14, 2018
@vicb vicb closed this in 7ac34e4 Feb 15, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
…lar#22185)

@Injectable() supports a scope parameter which specifies the target module.
However, it's still difficult to specify that a particular service belongs
in the root injector. A developer attempting to ensure that must either
also provide a module intended for placement in the root injector or target
a module known to already be in the root injector (e.g. BrowserModule).
Both of these strategies are cumbersome and brittle.

Instead, this commit adds a token APP_ROOT_SCOPE which provides a
straightforward way of targeting the root injector directly, without
requiring special knowledge of modules within it.

PR Close angular#22185
smdunn pushed a commit to smdunn/angular that referenced this pull request Feb 28, 2018
…lar#22185)

@Injectable() supports a scope parameter which specifies the target module.
However, it's still difficult to specify that a particular service belongs
in the root injector. A developer attempting to ensure that must either
also provide a module intended for placement in the root injector or target
a module known to already be in the root injector (e.g. BrowserModule).
Both of these strategies are cumbersome and brittle.

Instead, this commit adds a token APP_ROOT_SCOPE which provides a
straightforward way of targeting the root injector directly, without
requiring special knowledge of modules within it.

PR Close angular#22185
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
…lar#22185)

@Injectable() supports a scope parameter which specifies the target module.
However, it's still difficult to specify that a particular service belongs
in the root injector. A developer attempting to ensure that must either
also provide a module intended for placement in the root injector or target
a module known to already be in the root injector (e.g. BrowserModule).
Both of these strategies are cumbersome and brittle.

Instead, this commit adds a token APP_ROOT_SCOPE which provides a
straightforward way of targeting the root injector directly, without
requiring special knowledge of modules within it.

PR Close angular#22185
@sebholstein
Copy link
Contributor

@alxhub I don't find APP_ROOT_SCOPE in the public API of core. Is this intended in favor of providedIn?

@trotyl
Copy link
Contributor

trotyl commented May 4, 2018

@SebastianM This has been redesigned: #22655

@angular-automatic-lock-bot
Copy link

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 13, 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 target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants