My idea was to do this :
getCast(id:number, numCast:number){
return this.getCredits(id)
.map( credits => credits.cast.length >= numCast ? credits.cast.slice(0,numCast) : credits.cast )
.subscribe(character => {
for(let index in character){
return this.getPerson(character[index].id);
}
});
}
getPerson(person_id:number) {
return this.http.get('https://api.themoviedb.org/3/person/'+person_id+'?'+this.apiKey)
.map(data => JSON.parse(data['_body']))
}
this.mvs.getCast(this.route.snapshot.params['id'], 6)
.subscribe( data => { console.log(data); })
but it doesn't work at all. The error in console says:
_this.mvs.getCast(...).subscribe is not a function