Directive
Directive decorator
What it does
Marks a class as an Angular directive and collects directive configuration metadata.
How to use
import {Directive} from '@angular/core'; @Directive({ selector: 'my-directive', }) export class MyDirective { }
Description
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, compon