2015-11-06 12:26:24 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@cheatsheetSection
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								Class field decorators for directives and components
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-08 17:18:50 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@cheatsheetIndex 8
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@description
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-09 02:25:42 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{@target ts}`import { Input, ... } from '@angular/core';`{@endtarget}
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-12 21:17:26 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{@target js}Available from the `ng.core` namespace{@endtarget}
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@cheatsheetItem
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(ts):
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`@Input() myProperty;`|`@Input()`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-12 21:17:26 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(js):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`ng.core.Input(myProperty, myComponent);`|`ng.core.Input(`|`);`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-09 12:33:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								description:
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Declares an input property that you can update via property binding (example:
							 | 
						
					
						
							
								
									
										
										
										
											2016-01-19 20:29:19 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								`<my-cmp [myProperty]="someExpression">`).
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@cheatsheetItem
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(ts):
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`@Output() myEvent = new EventEmitter();`|`@Output()`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-12 21:17:26 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(js):
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								`myEvent = new ng.core.EventEmitter();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ng.core.Output(myEvent, myComponent);`|`ng.core.Output(`|`);`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-09 12:33:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								description:
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Declares an output property that fires events that you can subscribe to with an event binding (example: `<my-cmp (myEvent)="doSomething()">`).
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@cheatsheetItem
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(ts):
							 | 
						
					
						
							
								
									
										
										
										
											2016-12-06 01:25:40 +07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								`@HostBinding('class.valid') isValid;`|`@HostBinding('class.valid')`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-12 21:17:26 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(js):
							 | 
						
					
						
							
								
									
										
										
										
											2016-12-06 01:25:40 +07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								`ng.core.HostBinding('class.valid',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    'isValid', myComponent);`|`ng.core.HostBinding('class.valid', 'isValid'`|`);`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-09 12:33:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								description:
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Binds a host element property (here, the CSS class `valid`) to a directive/component property (`isValid`).
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@cheatsheetItem
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(ts):
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`@HostListener('click', ['$event']) onClick(e) {...}`|`@HostListener('click', ['$event'])`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-12 21:17:26 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(js):
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								`ng.core.HostListener('click',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    ['$event'], onClick(e) {...}, myComponent);`|`ng.core.HostListener('click', ['$event'], onClick(e)`|`);`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-09 12:33:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								description:
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Subscribes to a host element event (`click`) with a directive/component method (`onClick`), optionally passing an argument (`$event`).
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@cheatsheetItem
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(ts):
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`@ContentChild(myPredicate) myChildComponent;`|`@ContentChild(myPredicate)`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-12 21:17:26 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(js):
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								`ng.core.ContentChild(myPredicate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    'myChildComponent', myComponent);`|`ng.core.ContentChild(myPredicate,`|`);`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-09 12:33:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								description:
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Binds the first result of the component content query (`myPredicate`) to a property (`myChildComponent`) of the class.
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@cheatsheetItem
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(ts):
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`@ContentChildren(myPredicate) myChildComponents;`|`@ContentChildren(myPredicate)`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-12 21:17:26 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(js):
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								`ng.core.ContentChildren(myPredicate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    'myChildComponents', myComponent);`|`ng.core.ContentChildren(myPredicate,`|`);`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-09 12:33:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								description:
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Binds the results of the component content query (`myPredicate`) to a property (`myChildComponents`) of the class.
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@cheatsheetItem
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(ts):
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`@ViewChild(myPredicate) myChildComponent;`|`@ViewChild(myPredicate)`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-12 21:17:26 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(js):
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								`ng.core.ViewChild(myPredicate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    'myChildComponent', myComponent);`|`ng.core.ViewChild(myPredicate,`|`);`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-09 12:33:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								description:
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Binds the first result of the component view query (`myPredicate`) to a property (`myChildComponent`) of the class. Not available for directives.
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@cheatsheetItem
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(ts):
							 | 
						
					
						
							
								
									
										
										
										
											2015-11-05 15:04:55 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								`@ViewChildren(myPredicate) myChildComponents;`|`@ViewChildren(myPredicate)`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-12 21:17:26 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								syntax(js):
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								`ng.core.ViewChildren(myPredicate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    'myChildComponents', myComponent);`|`ng.core.ViewChildren(myPredicate,`|`);`
							 | 
						
					
						
							
								
									
										
										
										
											2015-12-09 12:33:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								description:
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-01 12:06:42 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Binds the results of the component view query (`myPredicate`) to a property (`myChildComponents`) of the class. Not available for directives.
							 |