ng g module module/about //创建模块about.module.tsng g component module/about //在module中创建组件,自动注册在about.module.ts中ng g component module/about/components/file //自动注册在about.module.ts中
一、配置一个路由模块
ng g module views/home --routingng g component views/home //配置主组件
二、配置模块中的路由
//home-routing.module.ts
import { HomeComponent } from './home.component';const routes: Routes = [{path:"",component:HomeComponent}]
三、配置主路由
const routes: Routes = [{path:"home",loadChildren:()=>import('./views/home/home.module').then(m=>m.HomeModule)}];
