mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
parent
ad9ba9a95f
commit
54a0ea785f
1 changed files with 1 additions and 1 deletions
|
|
@ -215,7 +215,7 @@ Use `@Self()` so that Angular will only look at the `ElementInjector` for the cu
|
|||
A good use case for `@Self()` is to inject a service but only if it is available on the current host element.
|
||||
To avoid errors in this situation, combine `@Self()` with `@Optional()`.
|
||||
|
||||
For example, in the following `SelfComponent`, notice the injected `LeafService` in the constructor.
|
||||
For example, in the following `SelfNoDataComponent`, notice the injected `LeafService` in the constructor.
|
||||
|
||||
<docs-code header="src/app/self-no-data/self-no-data.component.ts" language="typescript"
|
||||
highlight="[7]">
|
||||
|
|
|
|||
Loading…
Reference in a new issue