Created
May 19, 2016 17:03
-
-
Save erikpantzar/f1c0620011c17c5cb0d021bcc4a9ca67 to your computer and use it in GitHub Desktop.
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
import { Component } from '@angular/core'; | |
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated'; | |
import { DashboardComponent } from './dashboard.component'; | |
import { HeroesComponent } from './heroes.component'; | |
import { HeroDetailComponent } from './hero-detail.component'; | |
import { HeroService } from './hero.service'; | |
@Component({ | |
selector: 'my-app', | |
template: ` | |
<h1>{{title}}</h1> | |
<nav> | |
<a [routerLink]="['Dashboard']">Dashboard</a> | |
<a [routerLink]="['Heroes']">Heroes</a> | |
</nav> | |
<router-outlet></router-outlet> | |
`, | |
styleUrls: ['app/app.component.css'], | |
directives: [ROUTER_DIRECTIVES], | |
providers: [ | |
ROUTER_PROVIDERS, | |
HeroService, | |
] | |
}) | |
@RouteConfig([ | |
{ path: '/dashboard', name: 'Dashboard', component: DashboardComponent, useAsDefault: true }, | |
{ path: '/detail/:id', name: 'HeroDetail', component: HeroDetailComponent }, | |
{ path: '/heroes', name: 'Heroes', component: HeroesComponent } | |
]) | |
export class AppComponent { | |
title = 'Tour of Heroes'; | |
} | |
/* | |
Copyright 2016 Google Inc. All Rights Reserved. | |
Use of this source code is governed by an MIT-style license that | |
can be found in the LICENSE file at http://angular.io/license | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment