From b2ae7b607e2fb204af3251596dc68a2d0895e2bf Mon Sep 17 00:00:00 2001 From: Tsuyoshi Ito Date: Wed, 28 Dec 2016 09:58:33 +0900 Subject: [PATCH] docs(Core): fix API docs for ContentChild and ViewChildren (#13656) Move the documentations of the ContentChild and ViewChildren decorators so that they appear correctly on angular.io. Closes #13625 --- modules/@angular/core/src/metadata/di.ts | 109 ++++++++++++----------- tools/public_api_guard/core/index.d.ts | 5 +- 2 files changed, 61 insertions(+), 53 deletions(-) diff --git a/modules/@angular/core/src/metadata/di.ts b/modules/@angular/core/src/metadata/di.ts index 0622034b16..61647c95dc 100644 --- a/modules/@angular/core/src/metadata/di.ts +++ b/modules/@angular/core/src/metadata/di.ts @@ -225,7 +225,33 @@ export const ContentChildren: ContentChildrenDecorator = */ export interface ContentChildDecorator { /** - * @docsNotRequired + * @whatItDoes Configures a content query. + * + * @howToUse + * + * {@example core/di/ts/contentChild/content_child_howto.ts region='HowTo'} + * + * @description + * + * You can use ContentChild to get the first element or the directive matching the selector from + * the content DOM. If the content DOM changes, and a new child matches the selector, + * the property will be updated. + * + * Content queries are set before the `ngAfterContentInit` callback is called. + * + * **Metadata Properties**: + * + * * **selector** - the directive type or the name used for querying. + * * **read** - read a different token from the queried element. + * + * Let's look at an example: + * + * {@example core/di/ts/contentChild/content_child_example.ts region='Component'} + * + * **npm package**: `@angular/core` + * + * @stable + * @Annotation */ (selector: Type|Function|string, {read}?: {read?: any}): any; new (selector: Type|Function|string, {read}?: {read?: any}): ContentChild; @@ -241,30 +267,7 @@ export interface ContentChildDecorator { export type ContentChild = Query; /** - * @whatItDoes Configures a content query. - * - * @howToUse - * - * {@example core/di/ts/contentChild/content_child_howto.ts region='HowTo'} - * - * @description - * - * You can use ContentChild to get the first element or the directive matching the selector from the - * content DOM. If the content DOM changes, and a new child matches the selector, - * the property will be updated. - * - * Content queries are set before the `ngAfterContentInit` callback is called. - * - * **Metadata Properties**: - * - * * **selector** - the directive type or the name used for querying. - * * **read** - read a different token from the queried element. - * - * Let's look at an example: - * - * {@example core/di/ts/contentChild/content_child_example.ts region='Component'} - * - * **npm package**: `@angular/core` + * ContentChild decorator and metadata. * * @stable * @Annotation @@ -290,8 +293,35 @@ export const ContentChild: ContentChildDecorator = makePropDecorator( */ export interface ViewChildrenDecorator { /** - * @docsNotRequired - */ (selector: Type|Function|string, {read}?: {read?: any}): any; + * @whatItDoes Configures a view query. + * + * @howToUse + * + * {@example core/di/ts/viewChildren/view_children_howto.ts region='HowTo'} + * + * @description + * + * You can use ViewChildren to get the {@link QueryList} of elements or directives from the + * view DOM. Any time a child element is added, removed, or moved, the query list will be updated, + * and the changes observable of the query list will emit a new value. + * + * View queries are set before the `ngAfterViewInit` callback is called. + * + * **Metadata Properties**: + * + * * **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: + * + * {@example core/di/ts/viewChildren/view_children_example.ts region='Component'} + * + * **npm package**: `@angular/core` + * + * @stable + * @Annotation + */ + (selector: Type|Function|string, {read}?: {read?: any}): any; new (selector: Type|Function|string, {read}?: {read?: any}): ViewChildren; } @@ -303,30 +333,7 @@ export interface ViewChildrenDecorator { export type ViewChildren = Query; /** - * @whatItDoes Configures a view query. - * - * @howToUse - * - * {@example core/di/ts/viewChildren/view_children_howto.ts region='HowTo'} - * - * @description - * - * You can use ViewChildren to get the {@link QueryList} of elements or directives from the - * view DOM. Any time a child element is added, removed, or moved, the query list will be updated, - * and the changes observable of the query list will emit a new value. - * - * View queries are set before the `ngAfterViewInit` callback is called. - * - * **Metadata Properties**: - * - * * **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: - * - * {@example core/di/ts/viewChildren/view_children_example.ts region='Component'} - * - * **npm package**: `@angular/core` + * ViewChildren decorator and metadata. * * @stable * @Annotation diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index 4f5d319e8e..cbe523bdb3 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -278,7 +278,7 @@ export declare const ContentChild: ContentChildDecorator; /** @stable */ export interface ContentChildDecorator { - (selector: Type | Function | string, {read}?: { + /** @stable */ (selector: Type | Function | string, {read}?: { read?: any; }): any; new (selector: Type | Function | string, {read}?: { @@ -979,7 +979,8 @@ export interface ViewChildDecorator { export declare const ViewChildren: ViewChildrenDecorator; /** @stable */ -export interface ViewChildrenDecorator { (selector: Type | Function | string, {read}?: { +export interface ViewChildrenDecorator { + /** @stable */ (selector: Type | Function | string, {read}?: { read?: any; }): any; new (selector: Type | Function | string, {read}?: {