p.location-badge.
exported from angular2/annotations
defined in angular2/src/core/annotations/decorators.ts (line 51)
:markdown
Directive
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({...})
]
```