import { Directive , ElementRef , AfterViewInit , Input } from "@angular/core" ; @ Directive ( { selector : "[ngxfocus]" } ) export class FocusDirective implements AfterViewInit { @ Input ( "ngxfocus" ) value : string ; constructor ( private el ) { } ngAfterViewInit ( ) { if ( this . value === "0" ) { return ; } this . el . nativeElement . focus ( ) ; } }