Skip to content

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
@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