Last active
October 10, 2018 08:41
-
-
Save LayZeeDK/a7ad6f5fc6cf9fade8400cd118f40880 to your computer and use it in GitHub Desktop.
Dashboard: Container component model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChangeDetectionStrategy, Component } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { map } from 'rxjs/operators'; | |
import { Hero } from '../hero'; | |
import { HeroService } from '../hero.service'; | |
@Component({ | |
changeDetection: ChangeDetectionStrategy.OnPush, | |
selector: 'app-dashboard', | |
templateUrl: './dashboard.container.html', | |
}) | |
export class DashboardContainerComponent { | |
topHeroes$: Observable<Hero[]> = this.heroService.getHeroes().pipe( | |
map(heroes => heroes.slice(1, 5)), | |
); | |
constructor(private heroService: HeroService) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment