fix(angular): icon proxy

This commit is contained in:
Manu Mtz.-Almeida
2018-04-12 17:16:33 +02:00
parent 47e6009901
commit db5313e45b
3 changed files with 103 additions and 92 deletions

View File

@ -1,3 +1,14 @@
import { ElementRef } from '@angular/core';
export function inputs(instance: any, el: ElementRef, props: string[]) {
props.forEach(propName => {
Object.defineProperty(instance, propName, {
get: () => el.nativeElement[propName], set: (val: any) => el.nativeElement[propName] = val
});
});
}
export function proxyMethod(ctrlName: string, methodName: string, ...args: any[]) {
const controller = ensureElementInBody(ctrlName);
return controller.componentOnReady()