I have a controller that is consuming url parameters in the form /project/{id}
. Hoowever, my angular2 provider creates calls in the following form: /project?id=xxxx
.
How can I tell angular to call the service with the url format it is waiting for? My angular provider method:
let params: URLSearchParams = new URLSearchParams();
params.set('id', id);
let requestOptions = new RequestOptions();
requestOptions.search = params;
return new Promise<Project>((resolve) =>
this.http.get('/api/Project', requestOptions).subscribe(result => {
resolve(result.json());
})
);