docs(ContentChild): add example with refs

Add missing example on how ContentChild works with refs
Closes #7160
Closes #7162
This commit is contained in:
Wassim Chegham 2016-02-18 22:54:53 +01:00 committed by Misko Hevery
parent a38c9a1ef7
commit 1513e201bb
1 changed files with 9 additions and 0 deletions

View File

@ -1089,12 +1089,21 @@ export var ContentChildren: ContentChildrenMetadataFactory =
* }) * })
* class SomeDir { * class SomeDir {
* @ContentChild(ChildDirective) contentChild; * @ContentChild(ChildDirective) contentChild;
* @ContentChild('container_ref') containerChild
* *
* ngAfterContentInit() { * ngAfterContentInit() {
* // contentChild is set * // contentChild is set
* // containerChild is set
* } * }
* } * }
* ``` * ```
*
* ```html
* <container #container_ref>
* <item>a</item>
* <item>b</item>
* </container>
* ```
*/ */
export var ContentChild: ContentChildMetadataFactory = makePropDecorator(ContentChildMetadata); export var ContentChild: ContentChildMetadataFactory = makePropDecorator(ContentChildMetadata);