错误:组件X不属于任何NgModule或模块尚未导入到模块中

时间:2018-09-12 16:04:43

标签: angular ionic-framework

我正在构建ionic 4应用程序: 我的错误是什么,为什么我会收到此错误?看来是正确的:

app.module

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [
    BrowserModule, 
    IonicModule.forRoot(), 
    AppRoutingModule,
    HttpClientModule,
  ],
  providers: [ 
    StatusBar,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

app-routing.module

const routes: Routes = [
  { path: '', loadChildren: './tabs/tabs.module#TabsPageModule' },
  { path: 'home', loadChildren: './home/home.module#HomePageModule' },
  { path: 'timetable', loadChildren: './timetable/timetable.module#TimetablePageModule' },
  { path: 'artistDetail/:id', loadChildren: './artist-detail/artist-detail.module#ArtistDetailPageModule' },
  { path: 'artist', loadChildren: './artist/artist.module#ArtistPageModule' },
  { path: 'venue', loadChildren: './venue/venue.module#VenuePageModule' },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

venue.module

const routes: Routes = [
  {
    path: '',
    component: VenuePage
  }
];

@NgModule({
  imports: [
    CommonModule, 
    FormsModule,
    IonicModule,
    RouterModule.forChild(routes)
  ],
  declarations: [VenuePage]
})

0 个答案:

没有答案