我是angular2的新手,我想把多个组件放在一个routing.module.ts和一个module.ts中的多个模块。但是我收到错误Error: No NgModule metadata found for 'JobfileModule'.
我对任何可能的解决方案都很了解但是我仍然无法解决它仍然与我的代码风格混淆。
这是我的代码
routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { JobComponent } from './job.component';
import { JobfileComponent } from './jobfile.component';
const routes: Routes = [
{
path: '',
component: JobComponent, data: {
title: 'Job' }
},
{
path: '',
component: JobfileComponent, data: {
title: 'JobFile' }
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class JobRoutingModule {}
和my module.ts
import { NgModule } from '@angular/core';
import { ChartsModule } from 'ng2-charts/ng2-charts';
import { JobComponent } from './job.component';
import { JobfileComponent } from './jobfile.component';
import { JobRoutingModule } from './job-routing.module';
@NgModule({
imports: [
JobRoutingModule,
ChartsModule
],
declarations: [ JobComponent, JobfileComponent ]
})
export class JobModule { }
export class JobfileModule { }
我的代码出了什么问题?