angular-input-focus
Version:
An Angular focus attribute directive.
40 lines (39 loc) • 1.75 kB
TypeScript
import { ElementRef, NgZone, EventEmitter, OnDestroy, AfterViewInit, ChangeDetectorRef } from '@angular/core';
import * as i0 from "@angular/core";
export declare class AngularInputFocusDirective implements AfterViewInit, OnDestroy {
private el;
private cd;
private zone;
/**
* Indicates whether the current platform is a web browser. Used because our `focus`
* implementation is specific to the DOM. Set in constructor.
*/
private isRunningInBrowser;
/**
* When set to true, directive will mimick `autofocus` like functionality for your input.
*/
focus: boolean;
/**
* When you emit a true value, the input will gain focus. If false, the input will blur.
*/
set setFocus(value: EventEmitter<boolean>);
/**
* Set to true if you want to run outside angular and skip change detection. If you're not using
* Angular Material, you can pretty safely set to "true".
*/
skipChangeDetection: boolean;
/**
* A subject that will emit a value when we should unsubscribe to our observables.
*/
private killSubscriptions;
/**
* Set the focus on the target element.
* @param focus Should the element have focus?
*/
private setFocusOnElement;
constructor(el: ElementRef, cd: ChangeDetectorRef, zone: NgZone, platformId: string);
ngAfterViewInit(): void;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<AngularInputFocusDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<AngularInputFocusDirective, "[libFocus]", never, { "focus": "libFocus"; "setFocus": "setFocus"; "skipChangeDetection": "skipChangeDetection"; }, {}, never, never, false>;
}