import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; import { UserComponent } from './user.component' ; const routes = [ { path : ':username' , component : UserComponent } , { path : '**' , redirectTo : '' } ] ; @ NgModule ( { imports : [ RouterModule . forChild ( routes ) ] , exports : [ RouterModule ] } ) export class UserRoutingModule { }