在下面的代码中,companyId
是对象的数组,我想将此作为API调用的参数传递,我该怎么做?
getItems(): void {
this.urlcall()
.subscribe(
restItems => {
this.vehicle = restItems;
console.log('Vehicle Data=',this.vehicle);
});
}
urlcall() {
return this.http.get<any[]>(this.Url, { responseType : 'json',params : this.params ,headers : this.httpHeaders } )
.pipe(map(data => data));
}
public params = new HttpParams()
.set('CompanyID', this.companyID )
.set('vehicleId', '23')
.set('currentOdometer', this.cOdometer);
public httpHeaders = new HttpHeaders()
.set('Accept','application/x-www-form-urlencoded');