0
我用下面的代碼get方法如何通過多個嬰兒車在get方法angular2
this.required = {id:this.CategoriesId,fields:"courses.fields(largeIcon,instructor)", includes:"courses"};
this.courseraService.getEachCategory ("categories", this.required)
.subscribe (
response => this.Courses = response,
error => this.errorMessage = <any>error,
() => console.log(this.Courses)
);
getEachCategory(model,data){
this.url = this.heroesUrl + model;
console.log(this.url);
console.log(data);
var params = data;
return this.http.get(this.url + params)
.map (response => response.json())
.do(data => console.log ('All categories: ' + JSON.stringify(data)))
.catch(this.handleError);
}
我試圖通過參數作爲對象,但得到以下錯誤的URL
GET https://api.coursera.org/api/catalog.v1/categories[object%20Object]
謝謝你們的答案。 –