Created
June 24, 2016 11:02
-
-
Save sonicoder86/296ac7bbef8a525790cd3a9266073215 to your computer and use it in GitHub Desktop.
Upgrading to the new Angular 2 router - part 12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// routes.ts | |
import { provideRouter, RouterConfig } from '@angular/router'; | |
import { HeroesComponent } from './components/heroes/heroes.component'; | |
import { HeroDetailComponent } from './components/hero-detail/hero-detail.component'; | |
import { LoginComponent } from './components/login/login.component'; | |
import { AuthGuard } from './auth-guard'; | |
export const appRoutes: RouterConfig = [ | |
{ path: '', component: HeroesComponent, terminal: true }, | |
{ path: 'detail/:id', component: HeroDetailComponent, canActivate: [AuthGuard] }, | |
{ path: 'login', component: LoginComponent }, | |
]; | |
export const APP_ROUTER_PROVIDER = provideRouter(appRoutes); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment