47 lines
916 B
Plaintext
47 lines
916 B
Plaintext
|
|
p.location-badge.
|
|
exported from <a href='../annotations'>angular2/annotations</a>
|
|
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.34/modules/angular2/src/core/annotations/decorators.ts#L51-L104">angular2/src/core/annotations/decorators.ts (line 51)</a>
|
|
|
|
:markdown
|
|
<a href='Directive-var.html'><code>Directive</code></a> factory for creating annotations, decorators or DSL.
|
|
|
|
## Example as TypeScript Decorator
|
|
|
|
```
|
|
import {Directive} from "angular2/angular2";
|
|
|
|
@Directive({...})
|
|
class MyDirective {
|
|
constructor() {
|
|
...
|
|
}
|
|
}
|
|
```
|
|
|
|
## Example as ES5 DSL
|
|
|
|
```
|
|
var MyDirective = ng
|
|
.Directive({...})
|
|
.Class({
|
|
constructor: function() {
|
|
...
|
|
}
|
|
})
|
|
```
|
|
|
|
## Example as ES5 annotation
|
|
|
|
```
|
|
var MyDirective = function() {
|
|
...
|
|
};
|
|
|
|
MyDirective.annotations = [
|
|
new ng.Directive({...})
|
|
]
|
|
```
|
|
|
|
|