1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

move various angular bits into shared jslib

This commit is contained in:
Kyle Spearrin
2018-04-04 08:22:55 -04:00
parent 00bb0fdbdf
commit 579f970323
11 changed files with 366 additions and 16 deletions

View File

@@ -0,0 +1,24 @@
import {
Directive,
ElementRef,
Input,
} from '@angular/core';
@Directive({
selector: '[appAutofocus]',
})
export class AutofocusDirective {
@Input() set appAutofocus(condition: boolean | string) {
this.autofocus = condition === '' || condition === true;
}
private autofocus: boolean;
constructor(private el: ElementRef) { }
ngOnInit() {
if (this.autofocus) {
this.el.nativeElement.focus();
}
}
}