app/dxa/dxa-entity/views/dist-office-search-views/select-text-on-focus.directive.ts
Selector | [select-text-on-focus] |
Methods |
|
HostListeners |
constructor(element: ElementRef)
|
||||||
Parameters :
|
focus |
focus()
|
Private select |
select()
|
Returns :
void
|
import { Directive, Inject, ElementRef, HostListener } from '@angular/core';
@Directive({
selector: '[select-text-on-focus]'
})
export class SelectTextOnFocusDirective {
constructor(@Inject(ElementRef) private element: ElementRef) { }
@HostListener('focus') onFocus() {
this.select();
}
private select() {
this.element.nativeElement.select();
}
}