import { Routes , RouterModule } from '@angular/router' ; import { HomeComponent } from './home' ; import { AdminComponent } from './admin' ; import { LoginComponent } from './login' ; import { AuthGuard } from './_helpers' ; import { Role } from './_models' ; const routes = [ { path : '' , component : HomeComponent , canActivate : [ AuthGuard ] } , { path : 'admin' , component : AdminComponent , canActivate : [ AuthGuard ] , data : { roles : [ Role . Admin ] } } , { path : 'login' , component : LoginComponent } , { path : '**' , redirectTo : '' } ] ; export const appRoutingModule = RouterModule . forRoot ( routes ) ;