mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
fix(angular): change detection in deep ViewContainers
This commit is contained in:
@ -1,17 +1,9 @@
|
||||
import { ElementRef } from '@angular/core';
|
||||
|
||||
export function proxyMethod(ctrlName: string, methodName: string, ...args: any[]) {
|
||||
const controller = ensureElementInBody(ctrlName);
|
||||
return controller.componentOnReady()
|
||||
.then(() => (controller as any)[methodName].apply(controller, args));
|
||||
}
|
||||
|
||||
export function proxyEl(ref: ElementRef, methodName: string, ...args: any[]) {
|
||||
return ref.nativeElement.componentOnReady()
|
||||
.then((el: any) => el[methodName].apply(el, args));
|
||||
}
|
||||
|
||||
|
||||
export function ensureElementInBody(elementName: string) {
|
||||
let element = document.querySelector(elementName);
|
||||
if (!element) {
|
||||
|
Reference in New Issue
Block a user