import { NgModule } from '@angular/core' ; import { RouterModule , Routes } from '@angular/router' ; import { UserComponent } from '../user/user.component' ; import { LoginComponent } from '../login/login.component' ; const routes = [ { path : 'user' , component : UserComponent } , { path : 'login' , component : LoginComponent } , { path : '' , component : LoginComponent } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes ) ] , exports : [ RouterModule ] , declarations : [ ] } ) export class AppRoutingModule { }