angular-cn/public/docs/_examples/toh-5/ts/app/app.component.2.ts

29 lines
663 B
TypeScript
Raw Normal View History

2015-12-23 12:42:57 -05:00
// #docplaster
// #docregion
2016-04-27 14:28:22 -04:00
import { Component } from '@angular/core';
2015-12-23 12:42:57 -05:00
// #docregion import-router
import { ROUTER_DIRECTIVES } from '@angular/router';
2015-12-23 12:42:57 -05:00
// #enddocregion import-router
import { HeroService } from './hero.service';
@Component({
selector: 'my-app',
// #docregion template
2015-12-23 12:42:57 -05:00
template: `
<h1>{{title}}</h1>
<a [routerLink]="['/heroes']">Heroes</a>
2015-12-23 12:42:57 -05:00
<router-outlet></router-outlet>
`,
// #enddocregion template
// #docregion directives-and-providers
2015-12-23 12:42:57 -05:00
directives: [ROUTER_DIRECTIVES],
providers: [
HeroService
]
// #enddocregion directives-and-providers
})
export class AppComponent {
title = 'Tour of Heroes';
}