docs(core): updates query decorator docs
This commit is contained in:
parent
5972fdc817
commit
096ae7c404
|
@ -154,42 +154,12 @@ export abstract class Query {}
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export interface ContentChildrenDecorator {
|
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.
|
* @whatItDoes Configures a content query.
|
||||||
*
|
*
|
||||||
* @howToUse
|
* @howToUse
|
||||||
*
|
*
|
||||||
* ```
|
* {@example core/di/ts/contentChildren/content_children_howto.ts region='HowTo'}
|
||||||
* import {Directive, QueryList, ContentChildren} from '@angular/core';
|
|
||||||
*
|
|
||||||
* @Directive({
|
|
||||||
* selector: 'someDir'
|
|
||||||
* })
|
|
||||||
* class SomeDir {
|
|
||||||
* @ContentChildren(ChildDirective) contentChildren: QueryList<ChildDirective>;
|
|
||||||
*
|
|
||||||
* ngAfterContentInit() {
|
|
||||||
* // contentChildren is set
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
|
@ -215,7 +185,29 @@ export type ContentChildren = Query;
|
||||||
* @stable
|
* @stable
|
||||||
* @Annotation
|
* @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',
|
'ContentChildren',
|
||||||
[
|
[
|
||||||
['selector', undefined],
|
['selector', undefined],
|
||||||
|
@ -251,20 +243,7 @@ export type ContentChild = Query;
|
||||||
*
|
*
|
||||||
* @howToUse
|
* @howToUse
|
||||||
*
|
*
|
||||||
* ```
|
* {@example core/di/ts/contentChild/content_child_howto.ts region='HowTo'}
|
||||||
* import {Directive, ContentChild} from '@angular/core';
|
|
||||||
*
|
|
||||||
* @Directive({
|
|
||||||
* selector: 'someDir'
|
|
||||||
* })
|
|
||||||
* class SomeDir {
|
|
||||||
* @ContentChild(ChildDirective) contentChild;
|
|
||||||
*
|
|
||||||
* ngAfterContentInit() {
|
|
||||||
* // contentChild is set
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
|
@ -326,21 +305,7 @@ export type ViewChildren = Query;
|
||||||
*
|
*
|
||||||
* @howToUse
|
* @howToUse
|
||||||
*
|
*
|
||||||
* ```
|
* {@example core/di/ts/viewChildren/view_children_howto.ts region='HowTo'}
|
||||||
* import {Component, QueryList, ViewChildren} from '@angular/core';
|
|
||||||
*
|
|
||||||
* @Component({
|
|
||||||
* selector: 'someCmp',
|
|
||||||
* templateUrl: 'someCmp.html'
|
|
||||||
* })
|
|
||||||
* class SomeCmp {
|
|
||||||
* @ViewChildren(ChildDirective) viewChildren: QueryList<ChildDirective>;
|
|
||||||
*
|
|
||||||
* ngAfterViewInit() {
|
|
||||||
* // viewChildren is set
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
|
@ -385,39 +350,12 @@ export const ViewChildren: ViewChildrenDecorator = makePropDecorator(
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
export interface ViewChildDecorator {
|
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.
|
* @whatItDoes Configures a view query.
|
||||||
*
|
*
|
||||||
* @howToUse
|
* @howToUse
|
||||||
*
|
*
|
||||||
* ```
|
* {@example core/di/ts/viewChild/view_child_howto.ts region='HowTo'}
|
||||||
* import {Component, QueryList, ViewChild} from '@angular/core';
|
|
||||||
*
|
|
||||||
* @Component({
|
|
||||||
* selector: 'someCmp',
|
|
||||||
* templateUrl: 'someCmp.html'
|
|
||||||
* })
|
|
||||||
* class SomeCmp {
|
|
||||||
* @ViewChild(ChildDirective) child: ChildDirective;
|
|
||||||
*
|
|
||||||
* ngAfterViewInit() {
|
|
||||||
* // child is set
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
|
@ -432,7 +370,7 @@ export type ViewChild = Query;
|
||||||
* * **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.
|
||||||
*
|
*
|
||||||
* Let's look at an example:
|
* Let's look at an example!!!!:
|
||||||
*
|
*
|
||||||
* {@example core/di/ts/viewChild/view_child_example.ts region='Component'}
|
* {@example core/di/ts/viewChild/view_child_example.ts region='Component'}
|
||||||
*
|
*
|
||||||
|
@ -441,6 +379,23 @@ export type ViewChild = Query;
|
||||||
* @stable
|
* @stable
|
||||||
* @Annotation
|
* @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(
|
export const ViewChild: ViewChildDecorator = makePropDecorator(
|
||||||
'ViewChild',
|
'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
|
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
|
||||||
* the `MyCustomComponent` constructor function.
|
* the `MyCustomComponent` constructor function.
|
||||||
|
|
Loading…
Reference in New Issue