Last active
June 24, 2016 06:52
-
-
Save sonicoder86/f6327294620a8edd1b8b80df7723d111 to your computer and use it in GitHub Desktop.
Upgrading to the new Angular 2 router - part 1
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
// components/app/app.component.ts | |
import { Component } from '@angular/core'; | |
import { RouteConfig, ROUTER_DIRECTIVES } from '@angular/router-deprected'; | |
import { HeroesComponent } from './components/heroes/heroes.component'; | |
import { HeroDetailComponent } from '../hero-detail/hero-detail.component'; | |
@RouteConfig([ | |
{ | |
path: '/', | |
name: 'Heroes', | |
component: HeroesComponent, | |
useAsDefault: true | |
}, | |
{ | |
path: '/detail/:id', | |
name: 'HeroDetail', | |
component: HeroDetailComponent | |
} | |
]) | |
@Component({ | |
selector: 'hero-app', | |
template: '<router-outlet></router-outlet>', | |
directives: [ROUTER_DIRECTIVES] | |
}) | |
export class AppComponent {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment