import { Component , ViewEncapsulation , Input } from '@angular/core' ; import { PlayerService } from '../shared/player.service' ; import { ItunesService } from '../shared/itunes.service' ; @ Component ( { selector : 'app-track' , templateUrl : './track.component.html' , providers : [ ItunesService ] , styleUrls : [ './track.component.scss' ] , encapsulation : ViewEncapsulation . None } ) export class TrackComponent { view : Array < any > ; @ Input ( ) set collectionId ( collectionId ) { this . getTracks ( collectionId ) ; } constructor ( private itunesService , private playerService ) { } private getTracks ( collectionId ) { this . itunesService . getTracks ( collectionId ) . then ( result => { this . view = result ; } ) ; } }