找不到模块 angular 4

Cannot find a module angular 4

最初,应用程序显示登录页面并导航到主要内容组件,现在我想从仪表板组件导航到应用程序详细信息组件,但出现错误

Error: Component DashboardComponent is not part of any NgModule or the module has not been imported into your module.

在我的 app.module.ts 中,我已经导入了所有组件

以下是我在app.module.ts

中提到的路线
const appRoutes: Routes=[
    { path:'', redirectTo:'/login',pathMatch:'full'},
    { path: 'login', component: LoginComponent},
    { path: 'maincontent', loadChildren: 
'./maincontent/maincontent.module#MainContentModule'
    }
];

下面是MainContentModule中提到的路由

 export const ROUTES: Routes = [
  {
    path: 'maincontent',
    component: MainContentComponent,
    children: [
      { path: 'dashboard', component:DashboardComponent,
        loadChildren: './dashboard/dashboard.module#DashboardModule' },
        ]
      }
];
@NgModule({
  imports: [
    CommonModule,
    RouterModule.forChild(ROUTES)
  ],
  declarations: [],
  exports:[
    RouterModule,
  ]
})
export class MainContentModule {}

在我的 DasboardModule 中

export const ROUTES: Routes = [
  {
    path:'dashboard', component:DashboardComponent,
    children:[
      {
        path:'application',component:ApplicationDetailsComponent
      }
    ]
  }
]


@NgModule({
  imports: [
    CommonModule,
    RouterModule.forChild(ROUTES)
  ],
  declarations: [   ],
  exports:[
    RouterModule,
  ]
})
export class DashboardModule { }

任何帮助将不胜感激

在您的 MainContentModule 声明中添加 DashboardComponent

@NgModule({
  imports: [
    CommonModule,
    RouterModule.forChild(ROUTES)
  ],
  declarations: [DashboardComponent ],
  exports:[
    RouterModule,
  ]
})