mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
refactor(modal): simplify component loading
This commit is contained in:
@ -54,13 +54,12 @@ export class ModalCmp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ionViewPreLoad() {
|
ionViewPreLoad() {
|
||||||
this._load(this._navParams.data.component);
|
const component = this._navParams.data.component;
|
||||||
|
if (!component) {
|
||||||
|
console.warn('modal\'s page was not defined');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hidden */
|
|
||||||
_load(component: any) {
|
|
||||||
if (component) {
|
|
||||||
|
|
||||||
let cfr = this.moduleLoader.getComponentFactoryResolver(component);
|
let cfr = this.moduleLoader.getComponentFactoryResolver(component);
|
||||||
if (!cfr) {
|
if (!cfr) {
|
||||||
cfr = this._cfr;
|
cfr = this._cfr;
|
||||||
@ -82,7 +81,6 @@ export class ModalCmp {
|
|||||||
|
|
||||||
this._enabled = true;
|
this._enabled = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_viewWillEnter() {
|
_viewWillEnter() {
|
||||||
this._gestureBlocker.block();
|
this._gestureBlocker.block();
|
||||||
@ -92,7 +90,6 @@ export class ModalCmp {
|
|||||||
this._gestureBlocker.unblock();
|
this._gestureBlocker.unblock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hidden */
|
|
||||||
_setCssClass(componentRef: any, className: string) {
|
_setCssClass(componentRef: any, className: string) {
|
||||||
this._renderer.setElementClass(componentRef.location.nativeElement, className, true);
|
this._renderer.setElementClass(componentRef.location.nativeElement, className, true);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user