> create a new module of user && home with routing ``` ng g module module/user --routing ``` ``` ng g module module/home--routing ``` >create component user && home ``` ng g component module/home ``` ``` ng g component module/user ``` >Edit user-routeing , In order to initialize self component ~~~ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; //import user module to be routed Below import { UserComponent } from './user.component'; const routes: Routes = [ { path:"",component:UserComponent,//initlization component } ]; @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) export class UserRoutingModule { } ~~~ >also user component,When we finish writing, we also need to modify the route in the root component. >app-routing.module.ts ~~~ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; const routes: Routes = [ { // path:"user",loadChildren:"./module/user/user.module#UserModule" path:"user",loadChildren:()=>import("./module/user/user.module").then(mod=>mod.UserModule) }, { // path:"home",loadChildren:"./module/home/home.module#HomeModule" path:"home",loadChildren:()=>import("./module/home/home.module").then(mod=>mod.HomeModule) } ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule { } ~~~