Revert "chore(core): update public api file"

This reverts commit 727c2b38a4.

Revert "docs(core): updates query decorator docs"

This reverts commit b6287ccc51.

Revert "docs(core): extract how to examples"

This reverts commit 69e8ace884.
This commit is contained in:
Alex Eagle 2016-09-14 13:33:49 -07:00
parent 727c2b38a4
commit 5fad37df69
7 changed files with 119 additions and 213 deletions

View File

@ -155,35 +155,7 @@ export abstract class Query {}
*/ */
export interface ContentChildrenDecorator { export interface ContentChildrenDecorator {
/** /**
* @whatItDoes Configures a content query. * @docsNotRequired
*
* @howToUse
*
* {@example core/di/ts/contentChildren/content_children_howto.ts region='HowTo'}
*
* @description
*
* You can use ContentChildren to get the {@link QueryList} of elements or directives from the
* content 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.
*
* Content queries are set before the `ngAfterContentInit` callback is called.
*
* **Metadata Properties**:
*
* * **selector** - the directive type or the name used for querying.
* * **descendants** - include only direct children or all descendants.
* * **read** - read a different token from the queried elements.
*
* Let's look at an example:
*
* {@example core/di/ts/contentChildren/content_children_example.ts region='Component'}
*
* **npm package**: `@angular/core`
*
* @stable
* @Annotation
*/ */
(selector: Type<any>|Function|string, (selector: Type<any>|Function|string,
{descendants, read}?: {descendants?: boolean, read?: any}): any; {descendants, read}?: {descendants?: boolean, read?: any}): any;
@ -196,24 +168,60 @@ export interface ContentChildrenDecorator {
* Type of the ContentChildren metadata. * Type of the ContentChildren metadata.
* *
* @stable * @stable
* @Annotation
*/ */
export type ContentChildren = Query; export type ContentChildren = Query;
/** /**
* ContentChildren decorator and metadata. * @whatItDoes Configures a content query.
* *
* @stable * @howToUse
* @Annotation *
* ```
* import {Directive, QueryList, ContentChildren} from '@angular/core';
*
* @Directive({
* selector: 'someDir'
* })
* class SomeDir {
* @ContentChildren(ChildDirective) contentChildren: QueryList<ChildDirective>;
*
* ngAfterContentInit() {
* // contentChildren is set
* }
* }
* ```
*
* @description
*
* You can use ContentChildren to get the {@link QueryList} of elements or directives from the
* content 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.
*
* Content queries are set before the `ngAfterContentInit` callback is called.
*
* **Metadata Properties**:
*
* * **selector** - the directive type or the name used for querying.
* * **descendants** - include only direct children or all descendants.
* * **read** - read a different token from the queried elements.
*
* Let's look at an example:
*
* {@example core/di/ts/contentChildren/content_children_example.ts region='Component'}
*
* **npm package**: `@angular/core`
*
* @stable
* @Annotation
*/ */
export const ContentChildren: ContentChildrenDecorator = export const ContentChildren: ContentChildrenDecorator = makePropDecorator(
<ContentChildrenDecorator>makePropDecorator( 'ContentChildren',
'ContentChildren', [
[ ['selector', undefined],
['selector', undefined], {first: false, isViewQuery: false, descendants: false, read: undefined}
{first: false, isViewQuery: false, descendants: false, read: undefined} ],
], Query);
Query);
/** /**
* Type of the ContentChild decorator / constructor function. * Type of the ContentChild decorator / constructor function.
@ -243,7 +251,20 @@ 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
* *
@ -305,7 +326,21 @@ 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
* *
@ -351,35 +386,8 @@ export const ViewChildren: ViewChildrenDecorator = makePropDecorator(
*/ */
export interface ViewChildDecorator { export interface ViewChildDecorator {
/** /**
* @whatItDoes Configures a view query. * @docsNotRequired
* */ (selector: Type<any>|Function|string, {read}?: {read?: any}): any;
* @howToUse
*
* {@example core/di/ts/viewChild/view_child_howto.ts region='HowTo'}
*
* @description
*
* You can use ViewChild to get the first element or the directive matching the selector from the
* view DOM. If the view DOM changes, and a new child matches the selector,
* the property will be updated.
*
* 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/viewChild/view_child_example.ts region='Component'}
*
* **npm package**: `@angular/core`
*
* @stable
* @Annotation
*/
(selector: Type<any>|Function|string, {read}?: {read?: any}): any;
new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChild; new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChild;
} }
@ -391,7 +399,44 @@ export interface ViewChildDecorator {
export type ViewChild = Query; export type ViewChild = Query;
/** /**
* ViewChild decorator and metadata. * @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
* }
* }
* ```
*
* @description
*
* You can use ViewChild to get the first element or the directive matching the selector from the
* view DOM. If the view DOM changes, and a new child matches the selector,
* the property will be updated.
*
* 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/viewChild/view_child_example.ts region='Component'}
*
* **npm package**: `@angular/core`
* *
* @stable * @stable
* @Annotation * @Annotation

View File

@ -7,9 +7,7 @@
*/ */
/** /**
* @whatItDoes Represents a type that a Component or other object is instances of. * Runtime representation 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.

View File

@ -1,24 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// #docregion HowTo
import {AfterContentInit, Component, ContentChildren, Directive, QueryList} from '@angular/core';
@Directive({selector: 'child-directive'})
class ChildDirective {
}
@Directive({selector: 'someDir'})
class SomeDir implements AfterContentInit {
@ContentChild(ChildDirective) contentChild;
ngAfterContentInit() {
// contentChild is set
}
}
// #enddocregion

View File

@ -1,24 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// #docregion HowTo
import {AfterContentInit, Component, ContentChildren, Directive, QueryList} from '@angular/core';
@Directive({selector: 'child-directive'})
class ChildDirective {
}
@Directive({selector: 'someDir'})
class SomeDir implements AfterContentInit {
@ContentChildren(ChildDirective) contentChildren: QueryList<ChildDirective>;
ngAfterContentInit() {
// contentChildren is set
}
}
// #enddocregion

View File

@ -1,24 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// #docregion HowTo
import {AfterViewInit, Component, Directive, QueryList, ViewChild} from '@angular/core';
@Directive({selector: 'child-directive'})
class ChildDirective {
}
@Component({selector: 'someCmp', templateUrl: 'someCmp.html'})
class SomeCmp implements AfterViewInit {
@ViewChild(ChildDirective) child: ChildDirective;
ngAfterViewInit() {
// child is set
}
}
// #enddocregion

View File

@ -1,24 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// #docregion HowTo
import {AfterViewInit, Component, Directive, QueryList, ViewChildren} from '@angular/core';
@Directive({selector: 'child-directive'})
class ChildDirective {
}
@Component({selector: 'someCmp', templateUrl: 'someCmp.html'})
class SomeCmp implements AfterViewInit {
@ViewChildren(ChildDirective) viewChildren: QueryList<ChildDirective>;
ngAfterViewInit() {
// viewChildren is set
}
}
// #enddocregion

View File

@ -264,31 +264,9 @@ export declare abstract class ComponentRef<C> {
/** @stable */ /** @stable */
export declare const ContentChild: ContentChildDecorator; export declare const ContentChild: ContentChildDecorator;
/** @stable */
export interface ContentChildDecorator {
(selector: Type<any> | Function | string, {read}?: {
read?: any;
}): any;
new (selector: Type<any> | Function | string, {read}?: {
read?: any;
}): ContentChild;
}
/** @stable */ /** @stable */
export declare const ContentChildren: ContentChildrenDecorator; export declare const ContentChildren: ContentChildrenDecorator;
/** @stable */
export interface ContentChildrenDecorator {
/** @stable */ (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;
}
/** @experimental */ /** @experimental */
export declare function createPlatform(injector: Injector): PlatformRef; export declare function createPlatform(injector: Injector): PlatformRef;
@ -928,28 +906,9 @@ export interface ValueProvider {
/** @stable */ /** @stable */
export declare const ViewChild: ViewChildDecorator; export declare const ViewChild: ViewChildDecorator;
/** @stable */
export interface ViewChildDecorator {
/** @stable */ (selector: Type<any> | Function | string, {read}?: {
read?: any;
}): any;
new (selector: Type<any> | Function | string, {read}?: {
read?: any;
}): ViewChild;
}
/** @stable */ /** @stable */
export declare const ViewChildren: ViewChildrenDecorator; export declare const ViewChildren: ViewChildrenDecorator;
/** @stable */
export interface ViewChildrenDecorator { (selector: Type<any> | Function | string, {read}?: {
read?: any;
}): any;
new (selector: Type<any> | Function | string, {read}?: {
read?: any;
}): ViewChildren;
}
/** @stable */ /** @stable */
export declare abstract class ViewContainerRef { export declare abstract class ViewContainerRef {
element: ElementRef; element: ElementRef;