Description
Describe the problem that you experienced
The current documentation for @Injectable
does not mention that an injectable with providedIn: null
(or undefined
) can also be provided in a route's providers array.
This is a valid and useful use case, especially for providing services in a lazy-loaded route without modules. However, the documentation only mentions @NgModule, @component, and @directive as possible scopes where the injectable can be added manually.
More on providing to routes can be read in the angular routing guide here.
Enter the URL of the topic with the problem
https://angular.dev/api/core/Injectable
Describe what you were looking for in the documentation
Injectable reference should also mention that it can be provided in route's providers array.
Describe the actions that led you to experience the problem
I implemented a library without module and needed somewhere to provide top level but not application level services.
I totally forgot that there was route level providers.
Describe what you want to experience that would fix the problem
Instead of saying:
'null' : Equivalent to undefined. The injectable is not provided in any scope automatically and must be added to a providers array of an @NgModule, @Component or @Directive.
Add route level providers to the text.
Add a screenshot if that helps illustrate the problem
No response
If this problem caused an exception or error, please paste it here
If the problem is browser-specific, please specify the device, OS, browser, and version
Provide any additional information here in as much as detail as you can