mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor: add utility for coercing element refs (#14258)
Since we're having more and more APIs that accept both an `ElementRef` and an `Element`, we have a few places that repeat the same logic for coercing the value to an `Element`. These changes add a utility function that can be used everywhere.
This commit is contained in:
committed by
Jeremy Elbourn
parent
e673608476
commit
2463200324
Vendored
+2
-2
@@ -70,10 +70,10 @@ export declare class FocusKeyManager<T> extends ListKeyManager<FocusableOption &
|
||||
export declare class FocusMonitor implements OnDestroy {
|
||||
constructor(_ngZone: NgZone, _platform: Platform);
|
||||
_onBlur(event: FocusEvent, element: HTMLElement): void;
|
||||
focusVia(element: ElementRef<HTMLElement>, origin: FocusOrigin, options?: FocusOptions): void;
|
||||
focusVia(element: HTMLElement, origin: FocusOrigin, options?: FocusOptions): void;
|
||||
monitor(element: HTMLElement, checkChildren?: boolean): Observable<FocusOrigin>;
|
||||
focusVia(element: ElementRef<HTMLElement>, origin: FocusOrigin, options?: FocusOptions): void;
|
||||
monitor(element: ElementRef<HTMLElement>, checkChildren?: boolean): Observable<FocusOrigin>;
|
||||
monitor(element: HTMLElement, checkChildren?: boolean): Observable<FocusOrigin>;
|
||||
ngOnDestroy(): void;
|
||||
stopMonitoring(element: ElementRef<HTMLElement>): void;
|
||||
stopMonitoring(element: HTMLElement): void;
|
||||
|
||||
+2
@@ -6,5 +6,7 @@ export declare function coerceBooleanProperty(value: any): boolean;
|
||||
|
||||
export declare function coerceCssPixelValue(value: any): string;
|
||||
|
||||
export declare function coerceElement<T>(elementOrRef: ElementRef<T> | T): T;
|
||||
|
||||
export declare function coerceNumberProperty(value: any): number;
|
||||
export declare function coerceNumberProperty<D>(value: any, fallback: D): number | D;
|
||||
|
||||
Reference in New Issue
Block a user