I am calling an asp.net mvc web api controller action from an angular 2 application. I can accept objects from the call like this:
[Route("api/getItems")]
[HttpPost]
public ReturnObject GetItems(DateRangeVM dateRange){
}
However, I do not want to do a post, I want it to be a get, so when I am calling this from angular 2, I want something like this:
return this.http.post(this.API_URL_BASE + '/api/getItems', dateRange, defaultOptions).map((response: Response) => {
return <any[]>response.json();
}).catch(this.handleError);
}
but actually more like this:
return this.http.get(this.API_URL_BASE + '/api/getItems', dateRange, defaultOptions).map((response: Response) => {
return <any[]>response.json();
}).catch(this.handleError);
}
However, this last option does not accept data as the second option. I do not want to pass the data as string arguments because this is too messy when the data becomes more complex.