我刚刚开始重构我的应用程序,尝试使用Ionic 3 Lazy Loading。
例如,我有一个页面EventPage
,现在有一个EventPageModule
。
一切正常,用字符串引用导航到它。
但我无法做的就是从这个确切的页面打开一个子页面。
子页面为JoinersPage
...
JoinersPage:
// JoinersPage
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-joiners',
templateUrl: 'joiners.html',
})
export class JoinersPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad JoinersPage');
}
}
JoinersPageModule:
// JoinersPageModule
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { JoinersPage } from './joinersbis';
@NgModule({
declarations: [
JoinersPage,
],
imports: [
IonicPageModule.forChild(JoinersPage),
],
})
export class JoinersPageModule {}
EventPageModule:
// EventPageModule
import { NgModule } from '@angular/core';
import { MomentModule } from 'angular2-moment';
import { IonicPageModule } from 'ionic-angular';
import { IonicImageLoader } from 'ionic-image-loader';
import { DirectivesModule } from '../../directives/directives.module';
import { PipesModule } from '../../pipes/pipes.module';
import { EventPage } from './event';
import { EventChatComponent } from './event-chat/event-chat.component';
@NgModule({
declarations: [
EventPage,
EventChatComponent
],
imports: [
IonicPageModule.forChild(EventPage),
IonicImageLoader.forRoot(),
DirectivesModule,
MomentModule,
PipesModule
],
entryComponents: []
})
export class EventPageModule {}
当我点击应该打开JoinersPage
的按钮时,使用以下代码this.navCtrl.push('JoinersPage');
我收到以下错误:
Error: No component factory found for JoinersPage. Did you add it to @NgModule.entryComponents?
Error: No component factory found for JoinersPage. Did you add it to @NgModule.entryComponents?