fix(angular): change detection in deep ViewContainers

This commit is contained in:
Manu Mtz.-Almeida
2018-04-10 23:51:59 +02:00
parent 4d23cba8a0
commit 850d7fc74d
10 changed files with 182 additions and 172 deletions

View File

@ -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) {