As mentioned in the `universal` guide, the `toh-pt6` examples is the starting poitn for the `universal` example. However, the two examples had become out-of-sync, because some fixes/changes were made to the Tour-of-Heroes examples. This commit ports these changes to the `universal` example. PR Close #36483
24 lines
560 B
TypeScript
24 lines
560 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { Hero } from '../hero';
|
|
import { HeroService } from '../hero.service';
|
|
|
|
@Component({
|
|
selector: 'app-dashboard',
|
|
templateUrl: './dashboard.component.html',
|
|
styleUrls: [ './dashboard.component.css' ]
|
|
})
|
|
export class DashboardComponent implements OnInit {
|
|
heroes: Hero[] = [];
|
|
|
|
constructor(private heroService: HeroService) { }
|
|
|
|
ngOnInit() {
|
|
this.getHeroes();
|
|
}
|
|
|
|
getHeroes(): void {
|
|
this.heroService.getHeroes()
|
|
.subscribe(heroes => this.heroes = heroes.slice(1, 5));
|
|
}
|
|
}
|