File

app/dxa/dxa-entity/views/dist-office-search-views/select-text-on-focus.directive.ts

Metadata

Selector [select-text-on-focus]

Index

Methods
HostListeners

Constructor

constructor(element: ElementRef)
Parameters :
Name Type Optional
element ElementRef No

HostListeners

focus
focus()

Methods

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();
	}
}

result-matching ""

    No results matching ""