Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 98x 98x 98x 185x 98x 174x 174x 174x 98x | import { AfterViewInit, Directive, ElementRef } from '@angular/core'; import * as _ from 'lodash'; @Directive({ selector: '[autofocus]' // tslint:disable-line }) export class AutofocusDirective implements AfterViewInit { constructor(private elementRef: ElementRef) {} ngAfterViewInit() { const el: HTMLInputElement = this.elementRef.nativeElement; Eif (_.isFunction(el.focus)) { el.focus(); } } } |