angular 6 中缺少请求选项
request options is missing in angular 6
我已经将 angular 4 升级到 6,并且我使用 RequestOptions
通过这样的 http 删除请求发送数据
return this.http.delete(Config.apiUrl, new RequestOptions({
headers: this.heders,
body: data
})).map(res=>res.json());
现在升级后找不到了RequestOptions
导入过程在angular 4
import { Http, Headers, RequestOptions } from '@angular/http';
导入过程在angular6
import { HttpClient, HttpHeaders} from '@angular/common/http';
有什么想法吗?
HttpClient.prototype.delete() 过载。
最简单的方法是传递一个普通对象:
return this.http.delete(Config.apiUrl, {
headers: this.heders,//misspelt
body: data
}).map(res=>res.json());
另外,如果你想更好地控制请求,你可以构造一个 HttpRequest and pass it to HttpClient.prototype.request().
我已经将 angular 4 升级到 6,并且我使用 RequestOptions
通过这样的 http 删除请求发送数据
return this.http.delete(Config.apiUrl, new RequestOptions({
headers: this.heders,
body: data
})).map(res=>res.json());
现在升级后找不到了RequestOptions
导入过程在angular 4
import { Http, Headers, RequestOptions } from '@angular/http';
导入过程在angular6
import { HttpClient, HttpHeaders} from '@angular/common/http';
有什么想法吗?
HttpClient.prototype.delete() 过载。
最简单的方法是传递一个普通对象:
return this.http.delete(Config.apiUrl, {
headers: this.heders,//misspelt
body: data
}).map(res=>res.json());
另外,如果你想更好地控制请求,你可以构造一个 HttpRequest and pass it to HttpClient.prototype.request().