docs: clarifies the service limitation (#36349)

Closes #36332

PR Close #36349
This commit is contained in:
Sonu Kapoor 2020-03-31 06:44:13 -04:00 committed by Kara Erickson
parent b2a3325258
commit 5f64e52ed4
1 changed files with 2 additions and 2 deletions

View File

@ -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 components Another way to limit provider scope is by adding the service you want to limit to the components
`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 cant access it). Other components in the same module cant 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>