Angular 中添加 <router-outlet> 标签后报错

  1. If ‘router-outlet’ is an Angular component, then verify that it is part of this module.
  2. If ‘router-outlet’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.
app-routing.module
@NgModule({
  declarations: [],
  imports: [
    CommonModule,
    RouterModule.forRoot(
      appRoutes,
      { enableTracing: true }
    )
  ],
  exports: [ RouterModule ] // 在此处需要做导出
})

你可能感兴趣的:(angular,router-outlet)