如何从httpPUT请求获取数据? 控制器:
if (clientBalances.amount > currentAmount.amount)
{
return Content("Insufficient funds in your account");
}
成分:
headers.append('Content-Type', 'application/json');
this.http.put(this.originUrl + '/api/ClientBalances/Out', JSON.stringify(balance), { headers: headers }).subscribe(result => {
this.Message = result.json();
});
但是这只返回“状态为响应:URL为200 OK”。 我怎样才能得到我的信息?
答案 0 :(得分:0)
您缺少http方法的.map()
部分。您还需要从Http, Response
'@angular/http';
public method(): void {
let url: string = this.originUrl + '/api/ClientBalances/Out';
this.http.put(url, balance)
.map((res: Response) => res.json())
.subscribe((result: any) => {
});
}