我新增加了一个CustomerModule,文件列表如下:
customer.routing.ts 文件内容如下:
import { Routes, RouterModule } from '@angular/router';
import { CustomersComponent } from '../pages/customers/customers.component';
// noinspection TypeScriptValidateTypes
const routes: Routes = [
{
path: '',
component: CustomersComponent
}
];
export const routing = RouterModule.forChild(routes);
customers.module.ts文件内容如下:
import { CustomersComponent } from '../pages/customers/customers.component';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgaModule } from '../theme/nga.module';
import { PaginationModule, BsDropdownModule, ModalModule } from 'ngx-bootstrap';
import { routing } from '../routes/customer.routing';
import { CustomerService } from '../services/api/customer/customer.service';
@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
NgaModule,
PaginationModule.forRoot(),
BsDropdownModule.forRoot(),
ModalModule.forRoot(),
routing
],
providers: [
CustomerService
],
declarations: [
CustomersComponent
]
})
export class CustomerModule {}
pages.routing.ts文件内容如下:
import { Routes, RouterModule } from '@angular/router';
import { Pages } from './pages.component';
const routes: Routes = [
{ path: 'auth', loadChildren: () => System.import('./auth/auth.module') },
{ path: '',
component: Pages,
children: [
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
{ path: 'customer', loadChildren: () => System.import('../modules/customers.module') },
{ path: 'dashboard', loadChildren: () => System.import('./dashboard/dashboard.module') },
{ path: 'announcement', loadChildren: () => System.import('./announcement/announcement.module') },
{ path: 'article', loadChildren: () => System.import('./article/article.module') },
{ path: 'comment', loadChildren: () => System.import('./comment/comment.module') },
{ path: 'options', loadChildren: () => System.import('./options/options.module') },
{ path: 'linux', loadChildren: () => System.import('./linux/linux.module') },
{ path: 'auth', loadChildren: () => System.import('./auth/auth.module') },
{ path: 'demo',
children: [
{ path: 'ui', loadChildren: () => System.import('./demo/ui/ui.module') },
{ path: 'forms', loadChildren: () => System.import('./demo/forms/forms.module') },
{ path: 'tables', loadChildren: () => System.import('./demo/tables/tables.module') }
]
}
]
}
];
pages.menus.ts中的children节点增加一项:
{
path: 'customer',
data: {
menu: {
title: '客户',
icon: 'ion-radio-waves',
selected: false,
expanded: false,
order: 2,
}
}
},
重新编译以后,在地址栏输入/customer就在浏览器控制台输出错误:
NgModule metadata found for 'CustmoerModule'.
请问怎么解决这个问题呢?