| 
									
										
										
										
											2016-06-23 09:47:54 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @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
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-07 10:05:55 -07:00
										 |  |  | import {OpaqueToken} from '../di/opaque_token'; | 
					
						
							| 
									
										
										
										
											2016-08-10 18:21:28 -07:00
										 |  |  | import {Type} from '../type'; | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  | import {makeParamDecorator, makePropDecorator} from '../util/decorators'; | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-07 10:05:55 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * This token can be used to create a virtual provider that will populate the | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  |  * `entryComponents` fields of components and ng modules based on its `useValue`. | 
					
						
							| 
									
										
										
										
											2016-07-07 10:05:55 -07:00
										 |  |  |  * All components that are referenced in the `useValue` value (either directly | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  |  * or in a nested array or map) will be added to the `entryComponents` property. | 
					
						
							| 
									
										
										
										
											2016-07-07 10:05:55 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * ### Example | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  |  * The following example shows how the router can populate the `entryComponents` | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  |  * field of an NgModule based on the router configuration which refers | 
					
						
							| 
									
										
										
										
											2016-07-07 10:05:55 -07:00
										 |  |  |  * to components. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ```typescript
 | 
					
						
							|  |  |  |  * // helper function inside the router
 | 
					
						
							|  |  |  |  * function provideRoutes(routes) { | 
					
						
							|  |  |  |  *   return [ | 
					
						
							|  |  |  |  *     {provide: ROUTES, useValue: routes}, | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  |  *     {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true} | 
					
						
							| 
									
										
										
										
											2016-07-07 10:05:55 -07:00
										 |  |  |  *   ]; | 
					
						
							|  |  |  |  * } | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * // user code
 | 
					
						
							|  |  |  |  * let routes = [ | 
					
						
							|  |  |  |  *   {path: '/root', component: RootComp}, | 
					
						
							| 
									
										
										
										
											2016-09-05 21:37:21 +08:00
										 |  |  |  *   {path: '/teams', component: TeamsComp} | 
					
						
							| 
									
										
										
										
											2016-07-07 10:05:55 -07:00
										 |  |  |  * ]; | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-07-18 03:50:31 -07:00
										 |  |  |  * @NgModule({ | 
					
						
							| 
									
										
										
										
											2016-07-07 10:05:55 -07:00
										 |  |  |  *   providers: [provideRoutes(routes)] | 
					
						
							|  |  |  |  * }) | 
					
						
							|  |  |  |  * class ModuleWithRoutes {} | 
					
						
							|  |  |  |  * ```
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @experimental | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  | export const ANALYZE_FOR_ENTRY_COMPONENTS = new OpaqueToken('AnalyzeForEntryComponents'); | 
					
						
							| 
									
										
										
										
											2015-01-16 15:30:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-25 09:42:19 +01:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * Type of the Attribute decorator / constructor function. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @stable | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  | export interface AttributeDecorator { | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2016-09-16 10:57:57 -07:00
										 |  |  |    * Specifies that a constant attribute value should be injected. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * The directive can inject constant string literals of host element attributes. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ### Example | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Suppose we have an `<input>` element and want to know its `type`. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```html
 | 
					
						
							|  |  |  |    * <input type="text"> | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * A decorator can inject string literal `text` like so: | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * {@example core/ts/metadata/metadata.ts region='attributeMetadata'} | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ### Example as TypeScript Decorator | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * {@example core/ts/metadata/metadata.ts region='attributeFactory'} | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ### Example as ES5 DSL | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * var MyComponent = ng | 
					
						
							|  |  |  |    *   .Component({...}) | 
					
						
							|  |  |  |    *   .Class({ | 
					
						
							|  |  |  |    *     constructor: [new ng.Attribute('title'), function(title) { | 
					
						
							|  |  |  |    *       ... | 
					
						
							|  |  |  |    *     }] | 
					
						
							|  |  |  |    *   }) | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ### Example as ES5 annotation | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * var MyComponent = function(title) { | 
					
						
							|  |  |  |    *   ... | 
					
						
							|  |  |  |    * }; | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * MyComponent.annotations = [ | 
					
						
							|  |  |  |    *   new ng.Component({...}) | 
					
						
							|  |  |  |    * ] | 
					
						
							|  |  |  |    * MyComponent.parameters = [ | 
					
						
							|  |  |  |    *   [new ng.Attribute('title')] | 
					
						
							|  |  |  |    * ] | 
					
						
							|  |  |  |    * ```
 | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * @stable | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   (name: string): any; | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |   new (name: string): Attribute; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Type of the Attribute metadata. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export interface Attribute { attributeName?: string; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Attribute decorator and metadata. | 
					
						
							| 
									
										
										
										
											2015-09-17 22:33:51 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * @stable | 
					
						
							|  |  |  |  * @Annotation | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 20:30:42 -07:00
										 |  |  | export const Attribute: AttributeDecorator = | 
					
						
							|  |  |  |     makeParamDecorator('Attribute', [['attributeName', undefined]]); | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Type of the Query metadata. | 
					
						
							| 
									
										
										
										
											2015-09-17 22:33:51 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-08-15 16:07:55 -07:00
										 |  |  |  * @stable | 
					
						
							| 
									
										
										
										
											2015-03-13 11:39:15 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  | export interface Query { | 
					
						
							| 
									
										
										
										
											2015-06-10 17:08:22 -07:00
										 |  |  |   descendants: boolean; | 
					
						
							| 
									
										
										
										
											2015-09-19 18:39:35 -07:00
										 |  |  |   first: boolean; | 
					
						
							| 
									
										
										
										
											2016-04-18 13:24:42 -07:00
										 |  |  |   read: any; | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |   isViewQuery: boolean; | 
					
						
							|  |  |  |   selector: any; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-09-17 22:33:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-12 19:34:14 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * Base class for query metadata. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * See {@link ContentChildren}, {@link ContentChild}, {@link ViewChildren}, {@link ViewChild} for | 
					
						
							|  |  |  |  * more information. | 
					
						
							| 
									
										
										
										
											2016-09-12 19:34:14 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @stable | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  | export abstract class Query {} | 
					
						
							| 
									
										
										
										
											2015-06-10 17:08:22 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Type of the ContentChildren decorator / constructor function. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * See {@link ContentChildren}. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * @stable | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  | export interface ContentChildrenDecorator { | 
					
						
							| 
									
										
										
										
											2015-09-17 22:33:51 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  |    * @whatItDoes Configures a content query. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * @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 | 
					
						
							| 
									
										
										
										
											2015-09-17 22:33:51 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |   (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; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-07-10 10:30:31 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Type of the ContentChildren metadata. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @stable | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  |  * @Annotation | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  */ | 
					
						
							|  |  |  | export type ContentChildren = Query; | 
					
						
							| 
									
										
										
										
											2015-06-10 17:08:22 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  |  * ContentChildren decorator and metadata. | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  |  *  @stable | 
					
						
							|  |  |  |  *  @Annotation | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  | export const ContentChildren: ContentChildrenDecorator = | 
					
						
							|  |  |  |     <ContentChildrenDecorator>makePropDecorator( | 
					
						
							|  |  |  |         'ContentChildren', | 
					
						
							|  |  |  |         [ | 
					
						
							| 
									
										
										
										
											2016-09-16 10:57:57 -07:00
										 |  |  |           ['selector', undefined], { | 
					
						
							|  |  |  |             first: false, | 
					
						
							|  |  |  |             isViewQuery: false, | 
					
						
							|  |  |  |             descendants: false, | 
					
						
							|  |  |  |             read: undefined, | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  |         ], | 
					
						
							|  |  |  |         Query); | 
					
						
							| 
									
										
										
										
											2015-06-15 15:18:11 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Type of the ContentChild decorator / constructor function. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * @stable | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  | export interface ContentChildDecorator { | 
					
						
							| 
									
										
										
										
											2015-09-17 22:33:51 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |    * @docsNotRequired | 
					
						
							| 
									
										
										
										
											2015-09-17 22:33:51 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |   (selector: Type<any>|Function|string, {read}?: {read?: any}): any; | 
					
						
							|  |  |  |   new (selector: Type<any>|Function|string, {read}?: {read?: any}): ContentChild; | 
					
						
							| 
									
										
										
										
											2015-03-13 11:39:15 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-07-10 10:30:31 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-17 18:45:14 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * Type of the ContentChild metadata. | 
					
						
							| 
									
										
										
										
											2015-09-17 18:45:14 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * See {@link ContentChild}. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-05-25 15:00:05 -07:00
										 |  |  |  * @stable | 
					
						
							| 
									
										
										
										
											2015-09-17 18:45:14 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  | export type ContentChild = Query; | 
					
						
							| 
									
										
										
										
											2015-09-17 18:45:14 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-19 18:39:35 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * @whatItDoes Configures a content query. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @howToUse | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  |  * {@example core/di/ts/contentChild/content_child_howto.ts region='HowTo'} | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @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` | 
					
						
							| 
									
										
										
										
											2015-09-19 18:39:35 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-05-25 15:00:05 -07:00
										 |  |  |  * @stable | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * @Annotation | 
					
						
							| 
									
										
										
										
											2015-09-19 18:39:35 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  | export const ContentChild: ContentChildDecorator = makePropDecorator( | 
					
						
							| 
									
										
										
										
											2016-09-12 20:30:42 -07:00
										 |  |  |     'ContentChild', | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |     [ | 
					
						
							|  |  |  |       ['selector', undefined], { | 
					
						
							|  |  |  |         first: true, | 
					
						
							|  |  |  |         isViewQuery: false, | 
					
						
							| 
									
										
										
										
											2016-09-16 11:14:49 -07:00
										 |  |  |         descendants: true, | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |         read: undefined, | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     ], | 
					
						
							|  |  |  |     Query); | 
					
						
							| 
									
										
										
										
											2015-09-19 18:39:35 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-10 10:30:31 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  |  * Type of the ViewChildren decorator / constructor function. | 
					
						
							| 
									
										
										
										
											2015-09-17 22:33:51 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * See {@ViewChildren}. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-08-15 16:07:55 -07:00
										 |  |  |  * @stable | 
					
						
							| 
									
										
										
										
											2015-07-10 10:30:31 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  | export interface ViewChildrenDecorator { | 
					
						
							| 
									
										
										
										
											2015-09-17 22:33:51 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |    * @docsNotRequired | 
					
						
							|  |  |  |  */ (selector: Type<any>|Function|string, {read}?: {read?: any}): any; | 
					
						
							|  |  |  |   new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChildren; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Type of the ViewChildren metadata. | 
					
						
							| 
									
										
										
										
											2015-09-17 18:45:14 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * @stable | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export type ViewChildren = Query; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * @whatItDoes Configures a view query. | 
					
						
							| 
									
										
										
										
											2015-09-17 18:45:14 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * @howToUse | 
					
						
							| 
									
										
										
										
											2016-02-19 15:31:27 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  |  * {@example core/di/ts/viewChildren/view_children_howto.ts region='HowTo'} | 
					
						
							| 
									
										
										
										
											2016-02-19 15:31:27 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * @description | 
					
						
							| 
									
										
										
										
											2016-02-19 15:31:27 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * 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. | 
					
						
							| 
									
										
										
										
											2016-02-19 15:31:27 +09:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * View queries are set before the `ngAfterViewInit` callback is called. | 
					
						
							| 
									
										
										
										
											2015-09-17 18:45:14 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * **Metadata Properties**: | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * * **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` | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @stable | 
					
						
							|  |  |  |  * @Annotation | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  | export const ViewChildren: ViewChildrenDecorator = makePropDecorator( | 
					
						
							| 
									
										
										
										
											2016-09-12 20:30:42 -07:00
										 |  |  |     'ViewChildren', | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |     [ | 
					
						
							|  |  |  |       ['selector', undefined], { | 
					
						
							|  |  |  |         first: false, | 
					
						
							|  |  |  |         isViewQuery: true, | 
					
						
							|  |  |  |         descendants: true, | 
					
						
							|  |  |  |         read: undefined, | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     ], | 
					
						
							|  |  |  |     Query); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  |  * Type of the ViewChild decorator / constructor function. | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * See {@link ViewChild} | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * @stable | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  | export interface ViewChildDecorator { | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  |    * @whatItDoes Configures a view query. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * @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. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * {@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; | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |   new (selector: Type<any>|Function|string, {read}?: {read?: any}): ViewChild; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Type of the ViewChild metadata. | 
					
						
							| 
									
										
										
										
											2015-09-19 18:39:35 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-09-13 10:47:01 -07:00
										 |  |  |  * @stable | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export type ViewChild = Query; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							| 
									
										
										
										
											2016-09-14 11:51:15 -07:00
										 |  |  |  * ViewChild decorator and metadata. | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * @stable | 
					
						
							|  |  |  |  * @Annotation | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-12 19:14:17 -07:00
										 |  |  | export const ViewChild: ViewChildDecorator = makePropDecorator( | 
					
						
							| 
									
										
										
										
											2016-09-12 20:30:42 -07:00
										 |  |  |     'ViewChild', | 
					
						
							| 
									
										
										
										
											2016-09-12 09:44:20 -07:00
										 |  |  |     [ | 
					
						
							|  |  |  |       ['selector', undefined], { | 
					
						
							|  |  |  |         first: true, | 
					
						
							|  |  |  |         isViewQuery: true, | 
					
						
							|  |  |  |         descendants: true, | 
					
						
							|  |  |  |         read: undefined, | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     ], | 
					
						
							|  |  |  |     Query); |