2
我正在使用ASP.NET Core和AngularJS 2.有一個http查詢參數的問題。無論我嘗試什麼,參數'quarter'
都不會傳遞給控制器。任何人都知道我在這裏想念什麼?如何在AngularJS 2中傳遞查詢參數?
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();
}
);
}
你是對的,但不能相信它有多簡單。其實我打電話給控制器,所以我所要做的就是將它追加到URL http.get('/ api/method /'+ this.quarter):( – Jalle