Marks a class as an Angular directive and collects directive configuration metadata.
import {Directive} from '@angular/core'; @Directive({ selector: 'my-directive', }) export class MyDirective { }
Directive decorator allows you to mark a class as an Angular directive and provide additional metadata that determines how the directive should be processed, instantiated and used at runtime.
Directives allow you to attach behavior to elements in the DOM..
A directive must belong to an NgModule in order for it to be usable by another directive, component, or application. To specify that a directive is a member of an NgModule, you should list it in the declarations
field of that NgModule.
In addition to the metadata configuration specified via the Directive decorator, directives can control their runtime behavior by implementing various Life-Cycle hooks.
Metadata Properties:
exported from @angular/core/index defined in @angular/core/src/metadata/directives.ts
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/core/index/Directive-decorator.html