import { Observable } from 'rxjs/Observable' ; import { ChangeDetectionStrategy , Component } from '@angular/core' ; import { FirebaseDatabaseService } from '../shared/services/firebase-database.service' ; import { SettingService } from '../shared/services/setting.service' ; @ Component ( { selector : 'pm-users' , templateUrl : './users.component.html' , styleUrls : [ './users.component.scss' ] , changeDetection : ChangeDetectionStrategy . OnPush } ) export class UsersComponent { public usersFromDb$ = this . db . getListKeyed ( 'users' , ref => ref . limitToFirst ( 5000 ) ) ; public users$ = Observable . combineLatest ( this . usersFromDb$ , this . ss . settings$ , ( userInfo , settings ) => { return userInfo . map ( ( user ) => { return { ... user , photo : user . photo || settings . assets . userAvatarImage } ; } ) ; } ) ; constructor ( private db , private ss ) { } trackByUsers ( index , item ) { return item . id ; } }