docs: clarifies the service limitation (#36349)
Closes #36332 PR Close #36349
This commit is contained in:
parent
b2a3325258
commit
5f64e52ed4
|
@ -58,8 +58,8 @@ Though you can provide services by lazy loading modules, not all services can be
|
||||||
Another way to limit provider scope is by adding the service you want to limit to the component’s
|
Another way to limit provider scope is by adding the service you want to limit to the component’s
|
||||||
`providers` array. Component providers and NgModule providers are independent of each other. This
|
`providers` array. Component providers and NgModule providers are independent of each other. This
|
||||||
method is helpful when you want to eagerly load a module that needs a service all to itself.
|
method is helpful when you want to eagerly load a module that needs a service all to itself.
|
||||||
Providing a service in the component limits the service only to that component (other components in
|
Providing a service in the component limits the service only to that component and its descendants.
|
||||||
the same module can’t access it).
|
Other components in the same module can’t access it.
|
||||||
|
|
||||||
<code-example path="providers/src/app/app.component.ts" region="component-providers" header="src/app/app.component.ts"></code-example>
|
<code-example path="providers/src/app/app.component.ts" region="component-providers" header="src/app/app.component.ts"></code-example>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue