根据传递的参数设置方法如下:
能不能传入一个对象,然后批量处理对象,得到改params,希望大神能解答一下。
this.http.post(`xxx`, null,
{
headers: new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' }),
params: new HttpParams({
fromObject: this.data //传入的参数对象
})
}
).subscribe(res => {
console.log(res);
})
这样就行了
这个问题 Angular5 得到了解决,但是 4.x 的话,自己写个通用函数。