import { Component , OnInit } from '@angular/core' ; import { Observable } from 'rxjs/Observable' ; import { Category , CategoryService } from '../category/category.service' ; @ Component ( { selector : 'db-welcome' , templateUrl : 'app/welcome/welcome.component.html' } ) export class WelcomeComponent implements OnInit { slideCategories : Category [ ] = [ ] ; cardCategories : Observable < Category [ ] > ; constructor ( private categoryServics ) { } ngOnInit ( ) { this . cardCategories = this . categoryServics . getCategories ( ) ; this . cardCategories . subscribe ( ( categories ) => { this . slideCategories = [ categories [ 0 ] , categories [ 1 ] , categories [ 2 ] ] ; } ) ; } }