UNPKG

k15t-aui-ng2

Version:

aui-ng2 is a set of angular 2 components, directives and services to simplify the integration with Atlassian products based on AUI/ADG. The library is still under development and is considered in an experimental state. So be aware that things will change

23 lines (18 loc) 472 B
import {AfterViewInit, Directive, ElementRef} from '@angular/core'; /** * Directive to move the focus to element where the directive it defined as attribute. */ @Directive({ selector: '[auiNgAutoFocus]' }) export class AuiNgAutoFocusDirective implements AfterViewInit { constructor( private elementRef: ElementRef ) {} ngAfterViewInit() { this.setFocus(); } setFocus() { this.elementRef.nativeElement.focus(); } }