Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. import { Directive, ElementRef, OnInit } from '@angular/core';
  2.  
  3. @Directive({
  4. selector: '[getfocus]',
  5. })
  6. export class AutofocusDirective implements OnInit{
  7. constructor(private el: ElementRef) {
  8.  
  9.  
  10.  
  11. }
  12. ngOnInit(){
  13. this.el.nativeElement.focus();
  14. console.log('focused', this.el.nativeElement);
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement