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