我正在尝试将某些路由放置在主路由之外,但出现错误:未捕获(承诺):错误:找不到模块“ app / user / user.module”
我的应用程序中有两个路由文件和两个模块文件:MainRouting和UserRouding
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{ path: '', pathMatch: 'full', loadChildren: 'app/user/user.module#UserModule' }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
// Routing Module for Child-Components - User | Requests
import { NgModule } from "@angular/core";
import { Routes, RouterModule } from '@angular/router';
// Child Components
import { CreateComponent } from './create/create.component';
import { EditComponent } from './edit/edit.component';
import { ListComponent } from './list/list.component';
const routes: Routes = [
{ path: 'create', component: CreateComponent },
{ path: '', component: ListComponent },
{ path: 'edit/:id', component: EditComponent }
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class UserRoutingModule {}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { UserRoutingModule } from './user-routing.module';
import { EditComponent } from './edit/edit.component';
import { CreateComponent } from './create/create.component';
import { ListComponent } from './list/list.component';
@NgModule({
imports: [ CommonModule, UserRoutingModule ],
declarations: [ EditComponent, CreateComponent, ListComponent ]
})
export class UserModule {}
我想尽可能地明确分隔路由和模块