Skip to content
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

APP_ROOT_SCOPE token #22185

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
7 participants
@alxhub
Copy link
Contributor

alxhub commented Feb 12, 2018

No description provided.

@googlebot googlebot added the cla: yes label Feb 12, 2018

@alxhub alxhub force-pushed the alxhub:app-root-scope branch from b39c35e to 8287550 Feb 12, 2018

@mary-poppins

This comment has been minimized.

Copy link

mary-poppins commented Feb 12, 2018

@mhevery mhevery added the comp: ivy label Feb 13, 2018

// 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.

This comment has been minimized.

Copy link
@mhevery

mhevery Feb 13, 2018

Member

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

This comment has been minimized.

Copy link
@alxhub

alxhub Feb 14, 2018

Author Contributor

Documented.

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

This comment has been minimized.

Copy link
@gkalpak

gkalpak Feb 13, 2018

Member

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

scope-undead

@alxhub alxhub force-pushed the alxhub:app-root-scope branch from 8287550 to eb6fa00 Feb 13, 2018

@mary-poppins

This comment has been minimized.

Copy link

mary-poppins commented Feb 13, 2018

@alxhub alxhub force-pushed the alxhub:app-root-scope branch from eb6fa00 to fbaf7ad Feb 13, 2018

@mary-poppins

This comment has been minimized.

Copy link

mary-poppins commented Feb 13, 2018

@mhevery mhevery added this to Sprint Backlog in Framework via automation Feb 14, 2018

feat: allow direct scoping of @Injectables to the root injector
@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.

@alxhub alxhub force-pushed the alxhub:app-root-scope branch from fbaf7ad to f57afca Feb 14, 2018

@mary-poppins

This comment has been minimized.

Copy link

mary-poppins commented Feb 14, 2018

Framework automation moved this from Sprint Backlog to Done / Merged Feb 15, 2018

@vicb vicb closed this in 7ac34e4 Feb 15, 2018

@mhevery mhevery moved this from Done / Merged to In progress in Framework Feb 16, 2018

@mhevery mhevery moved this from In progress to Docs in Framework Feb 16, 2018

@mhevery mhevery moved this from Docs to Done / Merged in Framework Feb 16, 2018

jbogarthyde added a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018

feat: allow direct scoping of @Injectables to the root injector (angu…
…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

feat: allow direct scoping of @Injectables to the root injector (angu…
…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

@mhevery mhevery removed this from Done / Merged in Framework Feb 28, 2018

leo6104 added a commit to leo6104/angular that referenced this pull request Mar 25, 2018

feat: allow direct scoping of @Injectables to the root injector (angu…
…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
@SebastianM

This comment has been minimized.

Copy link
Contributor

SebastianM commented May 3, 2018

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

@trotyl

This comment has been minimized.

Copy link
Contributor

trotyl commented May 4, 2018

@SebastianM This has been redesigned: #22655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.