最近准备把angularjs1.x的项目逐步重构升级到angular5。在摸索http的时候有些疑问。
如get方法,有多个参数的时候有没有类似于ng1.x的$http那样的,把参数放到一个对象里给params就能批量传递的方法呢?
this.heroesUrl
this.http.get(this.heroesUrl)
.toPromise()
.then(response => response.json().data as Hero[])
.catch(this.handleError);
有啊,第二个参数就是传递一个大的对象,其中有{params:xxx}
这是我ng4的一段get封装,5也应该差不多吧。