mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 05:21:52 +08:00
@ -107,8 +107,8 @@ import {Transition, TransitionOptions} from '../../transitions/transition';
|
|||||||
export class Modal extends ViewController {
|
export class Modal extends ViewController {
|
||||||
|
|
||||||
constructor(componentType, data: any = {}) {
|
constructor(componentType, data: any = {}) {
|
||||||
data.componentToPresent = componentType;
|
data.componentType = componentType;
|
||||||
super(ModalComponent, data);
|
super(ModalCmp, data);
|
||||||
this.viewType = 'modal';
|
this.viewType = 'modal';
|
||||||
this.isOverlay = true;
|
this.isOverlay = true;
|
||||||
}
|
}
|
||||||
@ -133,25 +133,24 @@ export class Modal extends ViewController {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ion-modal',
|
selector: 'ion-modal',
|
||||||
template: `
|
template:
|
||||||
<div class="backdrop"></div>
|
'<div class="backdrop"></div>' +
|
||||||
<div class="modal-wrapper">
|
'<div class="modal-wrapper">' +
|
||||||
<div #wrapper></div>
|
'<div #viewport></div>' +
|
||||||
</div>
|
'</div>'
|
||||||
`
|
|
||||||
})
|
})
|
||||||
class ModalComponent {
|
class ModalCmp {
|
||||||
|
|
||||||
@ViewChild('wrapper', {read: ViewContainerRef}) wrapper: ViewContainerRef;
|
@ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef;
|
||||||
|
|
||||||
constructor(private _loader: DynamicComponentLoader, private _navParams: NavParams, private _viewCtrl: ViewController) {
|
constructor(private _loader: DynamicComponentLoader, private _navParams: NavParams, private _viewCtrl: ViewController) {}
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewInit() {
|
onPageWillEnter() {
|
||||||
let component = this._navParams.data.componentToPresent;
|
this._loader.loadNextToLocation(this._navParams.data.componentType, this.viewport).then(componentRef => {
|
||||||
this._loader.loadNextToLocation(component, this.wrapper).then(componentInstance => {
|
this._viewCtrl.setInstance(componentRef.instance);
|
||||||
this._viewCtrl.setInstance(componentInstance.instance);
|
|
||||||
// TODO - validate what life cycle events aren't call and possibly call them here if needed
|
// manually fire onPageWillEnter() since ModalCmp's onPageWillEnter already happened
|
||||||
|
this._viewCtrl.willEnter();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user