Skip to content

Instantly share code, notes, and snippets.

@coderkan
Created April 19, 2020 13:35
Show Gist options
  • Save coderkan/b6d547836944930e13f8e6e3d3cb6cc3 to your computer and use it in GitHub Desktop.
Save coderkan/b6d547836944930e13f8e6e3d3cb6cc3 to your computer and use it in GitHub Desktop.
const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{
path: 'admin', component: AdminDashboardComponent,
canActivate: [AuthGuard],
data: {
role: 'ROLE_ADMIN'
}
},
{ path: 'user', component: UserDashboardComponent,
canActivate: [AuthGuard],
data: {
role: 'ROLE_USER'
}
},
{ path: '**', component: NotFoundComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment