Skip to content

Instantly share code, notes, and snippets.

@sonicoder86
Created June 24, 2016 11:02
Show Gist options
  • Save sonicoder86/296ac7bbef8a525790cd3a9266073215 to your computer and use it in GitHub Desktop.
Save sonicoder86/296ac7bbef8a525790cd3a9266073215 to your computer and use it in GitHub Desktop.
Upgrading to the new Angular 2 router - part 12
// 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