Skip to content

Commit

Permalink
docs: update @self() decorator explanation (#51342)
Browse files Browse the repository at this point in the history
PR Close #51342
  • Loading branch information
Sinan997 authored and pkozlowski-opensource committed Aug 13, 2023
1 parent 5212b47 commit 8693627
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aio/content/guide/hierarchical-dependency-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ For example, in the following `SelfComponent`, notice the injected `LeafService`

<code-example header="src/app/self-no-data/self-no-data.component.ts" path="resolution-modifiers/src/app/self-no-data/self-no-data.component.ts" region="self-no-data-component"></code-example>

In this example, there is a parent provider and injecting the service will return the value, however, injecting the service with `@Self()` and `@Optional()` will return `null` because `@Self()` tells the injector to stop searching in the current host element.
In this example, there is a parent provider and injecting the service will return the value, however, injecting the service with `@Self()` and `@Optional()` will return `null` because `@Self()` tells the injector to only search in the current host element.

Another example shows the component class with a provider for `FlowerService`.
In this case, the injector looks no further than the current `ElementInjector` because it finds the `FlowerService` and returns the tulip <code>&#x1F337;</code>.
Expand Down

0 comments on commit 8693627

Please sign in to comment.