docs(core): clarify supported ViewChild selectors (#22784)

PR Close #22784
This commit is contained in:
vincecampanale 2018-03-14 21:01:49 -04:00 committed by Kara Erickson
parent 7d006c5005
commit 4933e103d3
1 changed files with 13 additions and 0 deletions

View File

@ -321,8 +321,21 @@ export interface ViewChildDecorator {
* * **selector** - the directive type or the name used for querying. * * **selector** - the directive type or the name used for querying.
* * **read** - read a different token from the queried elements. * * **read** - read a different token from the queried elements.
* *
* Supported selectors include:
* * any class with the `@Component` or `@Directive` decorator
* * a template reference variable as a string (e.g. query `<my-component #cmp></my-component>
* with `@ViewChild('cmp')`)
* * any provider defined in the child component tree of the current component (e.g.
* `@ViewChild(SomeService) someService: SomeService`)
* * any provider defined through a string token (e.g. `@ViewChild('someToken') someTokenVal:
* any`)
* * a `TemplateRef` (e.g. query `<ng-template></ng-template>` with `@ViewChild(TemplateRef)
* template;`)
*
* @usageNotes * @usageNotes
* *
* {@example core/di/ts/viewChild/view_child_example.ts region='Component'}
*
* ### Example * ### Example
* *
* {@example core/di/ts/viewChild/view_child_howto.ts region='HowTo'} * {@example core/di/ts/viewChild/view_child_howto.ts region='HowTo'}