docs: edit copy and example in hierarchical injectors guide (#32501)

Fixes #32461

PR Close #32501
This commit is contained in:
Kapunahele Wong
2019-08-23 09:02:26 -04:00
committed by Matias Niemelä
parent 1716b91334
commit 33038f6ebe
2 changed files with 53 additions and 32 deletions

View File

@ -13,3 +13,19 @@ export class AppComponent {
constructor(public flower: FlowerService, public animal: AnimalService) {}
}
// #enddocregion inject-animal-service
// When using @Host() together with @SkipSelf() in
// child.component.ts for the AnimalService, add the
// following viewProviders array to the @Component metadata:
// viewProviders: [{ provide: AnimalService, useValue: { emoji: '🦔' } }]
// So, the entire @ChildComponent() decorator and its
// metadata should be as follows:
// @Component({
// selector: 'app-root',
// templateUrl: './app.component.html',
// styleUrls: [ './app.component.css' ],
// viewProviders: [{ provide: AnimalService, useValue: { emoji: '🦔' } }]
// })