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 | 92x 92x 92x 168x 92x 165x 165x 92x | 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;
if (_.isFunction(el.focus)) {
el.focus();
}
}
}
|