@Directive({
selector: '[appSetFocus]'
})
export class SetFocusDirective implements OnInit {
@Input('appSetFocus') set isFocused(value: boolean) {
if (value) {
this.renderer.invokeElementMethod(this.hostElement.nativeElement, 'focus');
}
}
constructor(private hostElement: ElementRef, private renderer: Renderer) {}
ngOnInit() {
console.log('***SetFocusDirective***');
}
}