我的Ionic3 Angular5应用程序出现了这个着名的错误。我已经阅读了很多关于同一错误的其他帖子,但似乎这些解决方案无法解决我的问题。
班级的结构:
AppModule是应用程序的主要模块,需要在main.ts中进行引导
SmashApp是app.component.ts中定义的主要类,“forRoot” 在AppModule中以一种急切的加载方式。 SmashApp在构造函数中 还将“tabs”定义为rootPage。
代码: app.module.ts
@NgModule({
declarations: [
SmashApp,
],
imports: [
BrowserModule,
HttpModule,
IonicModule.forRoot(SmashApp, {}, {
links: [
]
}),
/*TabsPageModule,*/
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
SmashApp,
],
providers: [
{ provide: ErrorHandler, useClass: IonicErrorHandler },
ConferenceData,
UserData,
InAppBrowser,
SplashScreen
]
})
export class AppModule { }
app.component.ts
@IonicPage()/*this might not be necessary*/
@Component({
templateUrl: 'app.template.html'
})
export class SmashApp {
@ViewChild(Nav) nav: Nav;
rootPage: string = 'tabs';
constructor(
public events: Events,
public userData: UserData,
public menu: MenuController,
public platform: Platform,
public confData: ConferenceData,
public storage: Storage,
public splashScreen: SplashScreen
) {
this.rootPage = 'tabs';
this.platformReady();
.
.
tabs.module.ts
@NgModule({
declarations: [
TabsPage,
],
imports: [
IonicPageModule.forChild(TabsPage),
],
exports:[
TabsPage
],
})
export class TabsPageModule {}
tabs.ts
@IonicPage({
name: 'tabs',
})
@Component({
selector: 'page-tabs',
templateUrl: 'tabs.html',
})
export class TabsPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad TabsPage');
}
}