* docs(toh-5): dashboard uses [routerLink] bindings #998 closes #998 * chore: temp add toh-5 to bad-code-excerpt-skip-patterns.txt
37 lines
839 B
TypeScript
37 lines
839 B
TypeScript
// #docplaster
|
|
// #docregion
|
|
// #docregion imports
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
import { Hero } from './hero';
|
|
import { HeroService } from './hero.service';
|
|
// #enddocregion imports
|
|
|
|
// #docregion metadata
|
|
@Component({
|
|
moduleId: module.id,
|
|
selector: 'my-dashboard',
|
|
templateUrl: 'dashboard.component.html',
|
|
// #enddocregion metadata
|
|
// #docregion css
|
|
styleUrls: [ 'dashboard.component.css' ]
|
|
// #enddocregion css
|
|
// #docregion metadata
|
|
})
|
|
// #enddocregion metadata
|
|
// #docregion class
|
|
export class DashboardComponent implements OnInit {
|
|
|
|
heroes: Hero[] = [];
|
|
|
|
// #docregion ctor
|
|
constructor(private heroService: HeroService) { }
|
|
// #enddocregion ctor
|
|
|
|
ngOnInit(): void {
|
|
this.heroService.getHeroes()
|
|
.then(heroes => this.heroes = heroes.slice(1, 5));
|
|
}
|
|
}
|
|
// #enddocregion class
|