我正在使用 ASP.NET Core 和 AngularJS 2。http 查询参数有问题。无论我尝试什么,参数 'quarter'
都不会传递给 Controller 。有人知道我在这里错过了什么吗?
getBookingsBySaleUnit() {
let params: URLSearchParams = new URLSearchParams();
params.set('quarter', '1');
let requestOptions = new RequestOptions();
requestOptions.search = params;
this.http.get('/api/method', requestOptions).subscribe(result => {
this.sales = result.json();
}
);
}
最佳答案
这对我有用:
let params: URLSearchParams = new URLSearchParams();
params.set('quarter', 1);
this.http.get('Result/Delete', { search: params })
.subscribe([...])
关于asp.net - 如何在 AngularJS 2 中传递查询参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43022423/