mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
41 lines
887 B
JavaScript
41 lines
887 B
JavaScript
import {ViewContainerRef} from 'angular2/src/core/compiler/view_container_ref';
|
|
|
|
import * as util from 'ionic/util';
|
|
|
|
|
|
export class NavItem {
|
|
|
|
constructor(nav, ComponentClass, params = {}) {
|
|
this.nav = nav;
|
|
this.Class = ComponentClass;
|
|
this.params = params;
|
|
this.id = util.nextUid();
|
|
}
|
|
|
|
setup() {
|
|
let resolve;
|
|
let promise = new Promise((res) => { resolve = res; });
|
|
|
|
let injector = null;
|
|
|
|
|
|
this.nav.loader.loadIntoExistingLocation(this.Class, this.nav.itemContent.elementRef, injector)
|
|
.then((componentRef) => {
|
|
|
|
console.log('Component loadIntoExistingLocation completed')
|
|
|
|
resolve();
|
|
});
|
|
|
|
|
|
// let vc = new ViewContainerRef(this.nav.viewManager, this.nav.elementRef);
|
|
|
|
// debugger
|
|
// let view = vc.create(this.Class, -1, this.nav.itemContent.elementRef, injector);
|
|
|
|
|
|
return promise;
|
|
}
|
|
|
|
}
|