mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
add/edit folders
This commit is contained in:
24
src/app/directives/autofocus.directive.ts
Normal file
24
src/app/directives/autofocus.directive.ts
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user