import { Directive , HostListener } from '@angular/core' ; @ Directive ( { selector : '[lowercase]' } ) export class LowercaseDirective { @ HostListener ( 'input' , [ '$event' ] ) onInputChange ( $event ) { $event . target . value = $event . target . value . toLowerCase ( ) ; } }