本文整理汇总了TypeScript中@angular/http.Response类的典型用法代码示例。如果您正苦于以下问题:TypeScript Response类的具体用法?TypeScript Response怎么用?TypeScript Response使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Response类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
.map((response: Response) => {
let meetingDate: MeetingDate = MeetingDate.parseFromBE(response.json());
console.log("addPotentialDateToMeeting, response meetingDate : ", meetingDate);
return meetingDate;
});
示例2: extractDataTable
// For DataTable
private extractDataTable(res: Response) {
const body = res.json();
return body.data || {};
}
示例3: handleError
private static handleError(error: Response) {
console.log("errors4days");
console.error(error);
return Observable.throw(error.json().error || 'Server error');
}
示例4: extractTestSuite
private static extractTestSuite(response: Response): TestSuite {
if(response.status != 200) throw new Error("Bad response status: " + response.status);
return TestSuiteService.convertFromTestSuiteOverview(response.json());
}
示例5:
.subscribe((res: Response) => {
this.data = res.json();
this.loading = false;
});
示例6:
.map((response: Response, index: number) => {
student.avatar = Avatar.toObject(response.json());
return student;
})
示例7: extractData
private extractData(res: Response) {
// console.log(res);
localStorage.setItem("auth_key", res.json().token.split(" ")[1]);
let body = res.json();
return body.data || {};
}
示例8: handleError
private handleError(error: Response) {
let errMsg = error.json();
errMsg = (errMsg.message) ? errMsg.message :
errMsg.status ? `${errMsg.status}` : 'Server error';
return Observable.throw(errMsg);
}