this.params={
"id": this.id,
"fields": "language,largeIcon,shortDescription,subtitleLanguagesCsv,video,videoId,aboutTheCourse,faq,courseSyllabus,courseFormat,suggestedReadings,instructor,estimatedClassWorkload,recommendedBackground,sessions.fields(durationString),instructors.fields(photo150,fullName,title,department,middleName),universities.fields(name,locationCity,logo,squareLogo),categories.fields(id,name)",
"includes": "universities,categories,instructors,sessions"
};
this.courseraService.view("courses",this.params)
.subscribe (response => {
this.courseDetails = response.elements[0];
}, error => this.errorMessage = <any>error);
view(model,data) {
this.url = this.courseraUrl + model;
let params: URLSearchParams = new URLSearchParams();
for (let key in data) {
params.set(key, data[key]);
}
let options = new RequestOptions({search: params});
return this.http.get(this.url ,options)
.map ( response => response.json())
// .do( data => console.log ('view: ' + JSON.stringify(data) ) )
.catch(this.handleError);
}
这显示了尝试使用url传递的数据中的错误。错误是:
Cannot read property 'photo150' of undefined