docs(core): updates query decorator docs
This commit is contained in:
parent
5972fdc817
commit
096ae7c404
|
@ -155,41 +155,11 @@ export abstract class Query {}
|
|||
*/
|
||||
export interface ContentChildrenDecorator {
|
||||
/**
|
||||
* @docsNotRequired
|
||||
*/
|
||||
(selector: Type<any>|Function|string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): any;
|
||||
new (
|
||||
selector: Type<any>|Function|string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): Query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the ContentChildren metadata.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export type ContentChildren = Query;
|
||||
|
||||
/**
|
||||
* @whatItDoes Configures a content query.
|
||||
*
|
||||
* @howToUse
|
||||
*
|
||||
* ```
|
||||
* import {Directive, QueryList, ContentChildren} from '@angular/core';
|
||||
*
|
||||
* @Directive({
|
||||
* selector: 'someDir'
|
||||
* })
|
||||
* class SomeDir {
|
||||
* @ContentChildren(ChildDirective) contentChildren: QueryList<ChildDirective>;
|
||||
*
|
||||
* ngAfterContentInit() {
|
||||
* // contentChildren is set
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* {@example core/di/ts/contentChildren/content_children_howto.ts region='HowTo'}
|
||||
*
|
||||
* @description
|
||||
*
|
||||
|
@ -215,7 +185,29 @@ export type ContentChildren = Query;
|
|||
* @stable
|
||||
* @Annotation
|
||||
*/
|
||||
export const ContentChildren: ContentChildrenDecorator = makePropDecorator(
|
||||
(selector: Type<any>|Function|string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): any;
|
||||
new (
|
||||
selector: Type<any>|Function|string,
|
||||
{descendants, read}?: {descendants?: boolean, read?: any}): Query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the ContentChildren metadata.
|
||||
*
|
||||
* @stable
|
||||
* @Annotation
|
||||
*/
|
||||
export type ContentChildren = Query;
|
||||
|
||||
/**
|
||||
* ContentChildren decorator and metadata.
|
||||
*
|
||||
* @stable
|
||||
* @Annotation
|
||||
*/
|
||||
export const ContentChildren: ContentChildrenDecorator =
|
||||
<ContentChildrenDecorator>makePropDecorator(
|
||||
'ContentChildren',
|
||||
[
|
||||
['selector', undefined],
|
||||
|
@ -251,20 +243,7 @@ export type ContentChild = Query;
|
|||
*
|
||||
* @howToUse
|
||||
*
|
||||
* ```
|
||||
* import {Directive, ContentChild} from '@angular/core';
|
||||
*
|
||||
* @Directive({
|
||||
* selector: 'someDir'
|
||||
* })
|
||||
* class SomeDir {
|
||||
* @ContentChild(ChildDirective) contentChild;
|
||||
*
|
||||
* ngAfterContentInit() {
|
||||
* // contentChild is set
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* {@example core/di/ts/contentChild/content_child_howto.ts region='HowTo'}
|
||||
*
|
||||
* @description
|
||||
*
|
||||
|
@ -326,21 +305,7 @@ export type ViewChildren = Query;
|
|||
*
|
||||
* @howToUse
|
||||
*
|
||||
* ```
|
||||
* import {Component, QueryList, ViewChildren} from '@angular/core';
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'someCmp',
|
||||
* templateUrl: 'someCmp.html'
|
||||
* })
|
||||
* class SomeCmp {
|
||||
* @ViewChildren(ChildDirective) viewChildren: QueryList<ChildDirective>;
|
||||
*
|
||||
* ngAfterViewInit() {
|
||||
* // viewChildren is set
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* {@example core/di/ts/viewChildren/view_children_howto.ts region='HowTo'}
|
||||
*
|
||||
* @description
|
||||
*
|
||||
|
@ -386,38 +351,11 @@ export const ViewChildren: ViewChildrenDecorator = makePropDecorator(
|
|||
*/
|
||||
export interface ViewChildDecorator {
|
||||
/**
|
||||
* @docsNotRequired
|
||||
*/ (selector: Type<any>|Function|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChild;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the ViewChild metadata.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export type ViewChild = Query;
|
||||
|
||||
/**
|
||||
* @whatItDoes Configures a view query.
|
||||
*
|
||||
* @howToUse
|
||||
*
|
||||
* ```
|
||||
* import {Component, QueryList, ViewChild} from '@angular/core';
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'someCmp',
|
||||
* templateUrl: 'someCmp.html'
|
||||
* })
|
||||
* class SomeCmp {
|
||||
* @ViewChild(ChildDirective) child: ChildDirective;
|
||||
*
|
||||
* ngAfterViewInit() {
|
||||
* // child is set
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* {@example core/di/ts/viewChild/view_child_howto.ts region='HowTo'}
|
||||
*
|
||||
* @description
|
||||
*
|
||||
|
@ -432,7 +370,7 @@ export type ViewChild = Query;
|
|||
* * **selector** - the directive type or the name used for querying.
|
||||
* * **read** - read a different token from the queried elements.
|
||||
*
|
||||
* Let's look at an example:
|
||||
* Let's look at an example!!!!:
|
||||
*
|
||||
* {@example core/di/ts/viewChild/view_child_example.ts region='Component'}
|
||||
*
|
||||
|
@ -441,6 +379,23 @@ export type ViewChild = Query;
|
|||
* @stable
|
||||
* @Annotation
|
||||
*/
|
||||
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
|
||||
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChild;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the ViewChild metadata.
|
||||
*
|
||||
* @stable
|
||||
*/
|
||||
export type ViewChild = Query;
|
||||
|
||||
/**
|
||||
* ViewChild decorator and metadata.
|
||||
*
|
||||
* @stable
|
||||
* @Annotation
|
||||
*/
|
||||
export const ViewChild: ViewChildDecorator = makePropDecorator(
|
||||
'ViewChild',
|
||||
[
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Runtime representation a type that a Component or other object is instances of.
|
||||
* @whatItDoes Represents a type that a Component or other object is instances of.
|
||||
*
|
||||
* @description
|
||||
*
|
||||
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
||||
* the `MyCustomComponent` constructor function.
|
||||
|
|
Loading…
Reference in New Issue