How to use the HTTP service provided by Angular2 in ES5 code? Here is the TypeScript example.
I basically need examples of GET and POST requests.
The example shown here is not working. get seems to be undefined.
Here is an example that doesn't work:
var SearchResultComponent = ng.core.Component({
selector: "search-result",
viewProviders: [ng.http.HTTP_PROVIDERS],
templateUrl: "componentTemplates/SearchResult.html"
}).Class({
constructor: [ng.http.HTTP_PROVIDERS, function(http) {
this.params = params;
this.http = http;
}],
ngOnInit: function(){
console.log(this.http.get); //undefined
}
})