@@ -4,77 +4,83 @@ Class field decorators for directives and components
44@description
55{@target ts}` import { Input, ... } from '@angular/core'; ` {@endtarget }
66{@target js}Available from the ` ng.core ` namespace{@endtarget }
7- {@target dart}` import 'package:angular2/core.dart'; ` {@endtarget }
87
98@cheatsheetItem
10- syntax(ts dart ):
9+ syntax(ts):
1110` @Input() myProperty; ` |` @Input() `
1211syntax(js):
1312` ng.core.Input(myProperty, myComponent); ` |` ng.core.Input( ` |` ); `
1413description:
15- Declares an input property that we can update via property binding (e.g.
14+ Declares an input property that you can update via property binding (example:
1615` <my-cmp [myProperty]="someExpression"> ` ).
1716
1817
1918@cheatsheetItem
20- syntax(ts dart ):
19+ syntax(ts):
2120` @Output() myEvent = new EventEmitter(); ` |` @Output() `
2221syntax(js):
23- ` myEvent = new ng.core.EventEmitter(); ng.core.Output(myEvent, myComponent); ` |` ng.core.Output( ` |` ); `
22+ `myEvent = new ng.core.EventEmitter();
23+ ng.core.Output(myEvent, myComponent);` | ` ng.core.Output(` | ` );`
2424description:
25- Declares an output property that fires events to which we can subscribe with an event binding (e.g. ` <my-cmp (myEvent)="doSomething()"> ` ).
25+ Declares an output property that fires events that you can subscribe to with an event binding (example: ` <my-cmp (myEvent)="doSomething()"> ` ).
2626
2727
2828@cheatsheetItem
29- syntax(ts dart ):
29+ syntax(ts):
3030` @HostBinding('[class.valid]') isValid; ` |` @HostBinding('[class.valid]') `
3131syntax(js):
32- ` ng.core.HostBinding('[class.valid]', 'isValid', myComponent); ` |` ng.core.HostBinding('[class.valid]', 'isValid' ` |` ); `
32+ `ng.core.HostBinding('[ class.valid] ',
33+ 'isValid', myComponent);` | ` ng.core.HostBinding('[ class.valid] ', 'isValid'` | ` );`
3334description:
34- Binds a host element property (e.g. CSS class valid) to directive/component property (e.g. isValid).
35+ Binds a host element property (here, the CSS class ` valid ` ) to a directive/component property (` isValid ` ).
3536
3637
3738
3839@cheatsheetItem
39- syntax(ts dart ):
40+ syntax(ts):
4041` @HostListener('click', ['$event']) onClick(e) {...} ` |` @HostListener('click', ['$event']) `
4142syntax(js):
42- ` ng.core.HostListener('click', ['$event'], onClick(e) {...}, myComponent); ` |` ng.core.HostListener('click', ['$event'], onClick(e) ` |` ); `
43+ `ng.core.HostListener('click',
44+ [ '$event'] , onClick(e) {...}, myComponent);` | ` ng.core.HostListener('click', [ '$event'] , onClick(e)` | ` );`
4345description:
44- Subscribes to a host element event (e.g. click) with a directive/component method (e.g. onClick), optionally passing an argument ($event).
46+ Subscribes to a host element event (` click ` ) with a directive/component method (` onClick ` ), optionally passing an argument (` $event ` ).
4547
4648
4749@cheatsheetItem
48- syntax(ts dart ):
50+ syntax(ts):
4951` @ContentChild(myPredicate) myChildComponent; ` |` @ContentChild(myPredicate) `
5052syntax(js):
51- ` ng.core.ContentChild(myPredicate, 'myChildComponent', myComponent); ` |` ng.core.ContentChild(myPredicate, ` |` ); `
53+ `ng.core.ContentChild(myPredicate,
54+ 'myChildComponent', myComponent);` | ` ng.core.ContentChild(myPredicate,` | ` );`
5255description:
53- Binds the first result of the component content query (myPredicate) to the myChildComponent property of the class.
56+ Binds the first result of the component content query (` myPredicate ` ) to a property ( ` myChildComponent ` ) of the class.
5457
5558
5659@cheatsheetItem
57- syntax(ts dart ):
60+ syntax(ts):
5861` @ContentChildren(myPredicate) myChildComponents; ` |` @ContentChildren(myPredicate) `
5962syntax(js):
60- ` ng.core.ContentChildren(myPredicate, 'myChildComponents', myComponent); ` |` ng.core.ContentChildren(myPredicate, ` |` ); `
63+ `ng.core.ContentChildren(myPredicate,
64+ 'myChildComponents', myComponent);` | ` ng.core.ContentChildren(myPredicate,` | ` );`
6165description:
62- Binds the results of the component content query (myPredicate) to the myChildComponents property of the class.
66+ Binds the results of the component content query (` myPredicate ` ) to a property ( ` myChildComponents ` ) of the class.
6367
6468
6569@cheatsheetItem
66- syntax(ts dart ):
70+ syntax(ts):
6771` @ViewChild(myPredicate) myChildComponent; ` |` @ViewChild(myPredicate) `
6872syntax(js):
69- ` ng.core.ViewChild(myPredicate, 'myChildComponent', myComponent); ` |` ng.core.ViewChild(myPredicate, ` |` ); `
73+ `ng.core.ViewChild(myPredicate,
74+ 'myChildComponent', myComponent);` | ` ng.core.ViewChild(myPredicate,` | ` );`
7075description:
71- Binds the first result of the component view query (myPredicate) to the myChildComponent property of the class. Not available for directives.
76+ Binds the first result of the component view query (` myPredicate ` ) to a property ( ` myChildComponent ` ) of the class. Not available for directives.
7277
7378
7479@cheatsheetItem
75- syntax(ts dart ):
80+ syntax(ts):
7681` @ViewChildren(myPredicate) myChildComponents; ` |` @ViewChildren(myPredicate) `
7782syntax(js):
78- ` ng.core.ViewChildren(myPredicate, 'myChildComponents', myComponent); ` |` ng.core.ViewChildren(myPredicate, ` |` ); `
83+ `ng.core.ViewChildren(myPredicate,
84+ 'myChildComponents', myComponent);` | ` ng.core.ViewChildren(myPredicate,` | ` );`
7985description:
80- Binds the results of the component view query (myPredicate) to the myChildComponents property of the class. Not available for directives.
86+ Binds the results of the component view query (` myPredicate ` ) to a property ( ` myChildComponents ` ) of the class. Not available for directives.
0 commit comments