-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.component.ts
30 lines (29 loc) · 1.02 KB
/
app.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Component } from '@angular/core';
import { RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
import { HeroService } from './shared/hero.service';
import { HeroComponent } from './+hero';
import { DashboardComponent } from './+dashboard';
import { HeroDetailComponent } from './+hero-detail';
@Component({
moduleId: module.id,
selector: 'app',
providers: [HeroService, ROUTER_PROVIDERS],
directives: [...ROUTER_DIRECTIVES],
template: `
<h1>{{title}}</h1>
<nav>
<a [routerLink]="['Dashboard']">Dashboard</a>
<a [routerLink]="['Heroes']">Heroes</a>
</nav>
<router-outlet></router-outlet>
`,
styleUrls: ['./app.component.css']
})
@RouteConfig([
{ path: '/dashboard', name: 'Dashboard', component: DashboardComponent, useAsDefault: true },
{ path: '/heroes', name: 'Heroes', component: HeroComponent },
{ path: '/detail/:id', name: 'HeroDetail', component: HeroDetailComponent }
])
export class AppComponent {
title: string = 'Tour of Heroes';
}