为什么在应用启动时未加载entrycomponent

时间:2019-09-07 20:00:41

标签: angular ionic-framework ionic3 angular5

Hi Ionic和Angular开发人员,

我正在Angular 5 Project Ionic 3中工作,我感到惊讶的是,直到我转到 entrycomponents 声明为 entrycomponents pages 的构造函数,页面,然后显示构造函数日志。

我希望entrycomponents页面自动加载。

app.module.ts

@NgModule({
  declarations: [
    MyApp,
    AboutPage,
    ContactPage,
    HomePage,
    TabsPage,
    ConversationPage,
  ],
  imports: [
//...
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    AboutPage,
    ContactPage,
    HomePage,
    TabsPage,    
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    ChatService,
  ]
})

home.ts

export class HomePage {

  constructor(){
console.log('home loaded');
}

about.ts

export class AboutPage {

  constructor(){
console.log('about loaded');
}

tabs.ts

export class TabsPage {

  tab1Root = HomePage;
  tab2Root = AboutPage;
  tab3Root = ContactPage;

}

0 个答案:

没有答案