2015-11-06 07:26:24 -05:00
|
|
|
@cheatsheetSection
|
|
|
|
Class decorators
|
2015-11-13 02:14:12 -05:00
|
|
|
@cheatsheetIndex 4
|
2015-11-05 10:04:55 -05:00
|
|
|
@description
|
2015-12-09 13:22:40 -05:00
|
|
|
{@target js ts}`import {Directive, ...} from 'angular2/angular2';`{@endtarget}
|
|
|
|
{@target dart}`import 'package:angular2/angular2.dart';`{@endtarget}
|
2015-11-05 10:04:55 -05:00
|
|
|
|
|
|
|
@cheatsheetItem
|
2015-12-09 13:22:40 -05:00
|
|
|
syntax(js ts):
|
2015-11-05 10:04:55 -05:00
|
|
|
`@Component({...})
|
|
|
|
class MyComponent() {}`|`@Component({...})`
|
2015-12-09 13:22:40 -05:00
|
|
|
syntax(dart):
|
|
|
|
`@Component(...)
|
|
|
|
class MyComponent() {}`|`@Component(...)`
|
2015-12-09 07:33:42 -05:00
|
|
|
description:
|
2015-11-05 10:04:55 -05:00
|
|
|
Declares that a class is a component and provides metadata about the component.
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2015-12-09 13:22:40 -05:00
|
|
|
syntax(js ts):
|
2015-11-05 10:04:55 -05:00
|
|
|
`@Pipe({...})
|
|
|
|
class MyPipe() {}`|`@Pipe({...})`
|
2015-12-09 13:22:40 -05:00
|
|
|
syntax(dart):
|
|
|
|
`@Pipe(...)
|
|
|
|
class MyPipe() {}`|`@Pipe(...)`
|
2015-12-09 07:33:42 -05:00
|
|
|
description:
|
2015-11-05 10:04:55 -05:00
|
|
|
Declares that a class is a pipe and provides metadata about the pipe.
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2015-12-09 13:22:40 -05:00
|
|
|
syntax(js ts):
|
|
|
|
`@Injectable()
|
|
|
|
class MyService() {}`|`@Injectable()`
|
|
|
|
syntax(dart):
|
2015-11-05 10:04:55 -05:00
|
|
|
`@Injectable()
|
|
|
|
class MyService() {}`|`@Injectable()`
|
2015-12-09 07:33:42 -05:00
|
|
|
description:
|
2015-11-05 10:04:55 -05:00
|
|
|
Declares that a class has dependencies that should be injected into the constructor when the dependency
|
2015-12-09 13:22:40 -05:00
|
|
|
injector is creating an instance of this class.
|