Im trying to use URLSearchParams to fill in querystring parameters and their values. However, the resulting url that seems to get used on the http call doesnt look like its including any of the querystring info. What am I doing wrong? Im looking at the network tab on the chrome dev tools
getBlogPost(postId:string): Observable<BlogPost> {
var myHeaders = new Headers();
myHeaders.append('Content-Type', 'application/json');
let myParams = new URLSearchParams();
myParams.append('Id', postId);
let options = new RequestOptions({ headers: myHeaders, params: myParams });
return this.http.get("http://myapi.testapp.com/api/gfNet/GetBlogPost",options)
.map((res: Response) => res.json())
.catch(this.handleError);
}
[ update ]
duh... this one of my import statements. Notice Im missing something
that something is URLSearchParams
Once I added that with the others from the http module, things started working and the url querystring showed up
import { Http, Response, Headers, RequestOptions} from '@angular/http';