本文整理汇总了TypeScript中@angular/http.Response.json方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Response.json方法的具体用法?TypeScript Response.json怎么用?TypeScript Response.json使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/http.Response
的用法示例。
在下文中一共展示了Response.json方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: extractData
private extractData(res: Response) {
let body = res.json();
// depends on what is the response from the remote server, change 'data' to the specific JSON tag
return body.orders || {};
}
示例2:
.subscribe((res: Response) => {
this.data = res.json();
this.loading = false;
});
示例3: extractData
private extractData(res: Response) {
let body = res.json();
return body || { };
}
示例4:
.map((res: Response) => {
return res.json();
})
示例5: extractData
private extractData(response: Response) {
if (response.status < 200 || response.status >= 300) {
throw new Error('Bad response status: ' + response.status);
}
return response.json();
}
示例6:
this.GetData.Getlist('http://www.binaryfrog.co/web/api/user_info.php?id='+this.uId).map((res: Response) => {
return res.json();
}).subscribe((data) => {
示例7: handleErrors
handleErrors(error: Response) {
console.log(JSON.stringify(error.json()));
alert(JSON.stringify(error.json()));
return Observable.throw(error);
}
示例8: extractData
private extractData(res: Response) {
let image = res.json();
return image || {};
}
示例9: handleError
private handleError(error: Response) {
console.log(error);
return Observable.throw(error.json().error || 'Server Error');
}
示例10: Deserialize
.map((res: Response) => {
const json = res.json();
const results = Deserialize(json, SearchResults);
return results;
});