import { RouterModule , Routes } from '@angular/router' ; import { NgModule } from '@angular/core' ; import { UserComponent } from './user.component' ; import { UserCenterComponent } from './user-center/user-center.component' ; import { UserSettingsComponent } from './user-settings/user-settings.component' ; const routes = [ { path : '' , component : UserComponent , children : [ { path : 'center' , component : UserCenterComponent } , { path : 'settings' , component : UserSettingsComponent } , ] , } , ] ; @ NgModule ( { imports : [ RouterModule . forChild ( routes ) ] , exports : [ RouterModule ] , } ) export class UserRoutingModule { }