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