angular declare directive code example Example: user defined directives in angular 7 import { Directive, ElementRef } from '@angular/core';