feat(angular): ion-nav

This commit is contained in:
Manu Mtz.-Almeida
2018-03-20 18:00:26 +01:00
parent d3105d1a76
commit f39d3ad9dd
6 changed files with 121 additions and 21 deletions

View File

@ -1,3 +1,4 @@
import { ElementRef } from '@angular/core';
export function proxyMethod(ctrlName: string, methodName: string, ...args: any[]) {
const controller = ensureElementInBody(ctrlName);
@ -5,6 +6,12 @@ export function proxyMethod(ctrlName: string, methodName: string, ...args: any[]
.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) {