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
docs(core): deprecate providedIn: NgModule
and providedIn: 'any'
#47616
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit deprecates the above two forms of `providedIn`. DEPRECATED: - The ability to pass an `NgModule` to the `providedIn` option for `@Injectable` and `InjectionToken` is now deprecated. `providedIn: NgModule` was intended to be a tree-shakable alternative to NgModule providers. It does not have wide usage, and in most cases is used incorrectly, in circumstances where `providedIn: 'root'` should be preferred. If providers should truly be scoped to a specific NgModule, use `NgModule.providers` instead. - The ability to set `providedIn: 'any'` for an `@Injectable` or `InjectionToken` is now deprecated. `providedIn: 'any'` is an option with confusing semantics and is almost never used apart from a handful of esoteric cases internal to the framework.
alxhub
force-pushed
the
v15/deprecations/providedIn
branch
from
October 3, 2022 21:12
6674034
to
f1043d9
Compare
pkozlowski-opensource
approved these changes
Oct 4, 2022
pkozlowski-opensource
added
the
action: merge
The PR is ready for merge by the caretaker
label
Oct 4, 2022
pkozlowski-opensource
added
the
target: major
This PR is targeted for the next major release
label
Oct 4, 2022
This PR was merged into the repository by commit e3cef4a. |
mprobst
pushed a commit
to mprobst/angular
that referenced
this pull request
Oct 5, 2022
…ngular#47616) This commit deprecates the above two forms of `providedIn`. DEPRECATED: - The ability to pass an `NgModule` to the `providedIn` option for `@Injectable` and `InjectionToken` is now deprecated. `providedIn: NgModule` was intended to be a tree-shakable alternative to NgModule providers. It does not have wide usage, and in most cases is used incorrectly, in circumstances where `providedIn: 'root'` should be preferred. If providers should truly be scoped to a specific NgModule, use `NgModule.providers` instead. - The ability to set `providedIn: 'any'` for an `@Injectable` or `InjectionToken` is now deprecated. `providedIn: 'any'` is an option with confusing semantics and is almost never used apart from a handful of esoteric cases internal to the framework. PR Close angular#47616
yharaskrik
pushed a commit
to yharaskrik/angular
that referenced
this pull request
Oct 5, 2022
…ngular#47616) This commit deprecates the above two forms of `providedIn`. DEPRECATED: - The ability to pass an `NgModule` to the `providedIn` option for `@Injectable` and `InjectionToken` is now deprecated. `providedIn: NgModule` was intended to be a tree-shakable alternative to NgModule providers. It does not have wide usage, and in most cases is used incorrectly, in circumstances where `providedIn: 'root'` should be preferred. If providers should truly be scoped to a specific NgModule, use `NgModule.providers` instead. - The ability to set `providedIn: 'any'` for an `@Injectable` or `InjectionToken` is now deprecated. `providedIn: 'any'` is an option with confusing semantics and is almost never used apart from a handful of esoteric cases internal to the framework. PR Close angular#47616
Can the providers docs be updated based on this as well? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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
target: major
This PR is targeted for the next major release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit deprecates the above two forms of
providedIn
.DEPRECATED:
NgModule
to theprovidedIn
option for@Injectable
andInjectionToken
is now deprecated.providedIn: NgModule
was intended to be a tree-shakable alternative to NgModule providers. It does not have wide usage, and in most cases is used incorrectly, in circumstances whereprovidedIn: 'root'
should be preferred. If providers should truly be scoped to a specific NgModule, useNgModule.providers
instead.providedIn: 'any'
for an@Injectable
orInjectionToken
is now deprecated.providedIn: 'any'
is an option with confusing semantics and is almost never used apart from a handful of esoteric cases internal to the framework.