core.js:18374错误:未捕获(承诺中):错误:找不到模块“”/orders/orders.module'
错误:找不到模块“”/orders/orders.module'
我不知道为什么会发生这样的事情
.../src/app/orders/orders.module.ts
.../src/app/orders
目录和其中的多个组件。为了实现这些模块,我这样做了
% mv src/app/orders orders
% ng g m orders --routing
% mv orders/* src/app/orders
然后我删除了所有的路线
app-routing.module.ts
{
path: 'orders',
loadChildren: './orders/orders.module#OrdersModule'
},
{
path: '',
redirectTo: 'orders',
pathMatch: 'full'
}
然后
orders-routing.module.ts
看起来是这样的:
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {OrderEditComponent} from './order-edit/order-edit.component';
import {OrderListComponent} from './order-list/order-list.component';
const routes: Routes = [
{path: 'edit', component: OrderEditComponent},
{path: 'byMonth', component: OrderListComponent},
{path: '', component: OrderListComponent},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class OrdersRoutingModule {
}
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {OrdersRoutingModule} from './orders-routing.module';
import {OrderListComponent} from './order-list/order-list.component';
import {OrderEditComponent} from './order-edit/order-edit.component';
@NgModule({
declarations: [
OrderListComponent,
OrderEditComponent
],
imports: [
CommonModule,
OrdersRoutingModule
]
})
export class OrdersModule {
}
您可以看到文件存在于适当的位置。