I\'ve been playing with Angular 2 Quickstart.
How can I use/import http module in Angular 2?
I\'ve looked at Angular 2 Todo\'s.js, but it doesn\'t use the ht
Much the same in Alpha 42, but it can be noted that Headers and HTTP_PROVIDERS also come from angular2/http.
import {Http, Headers, HTTP_PROVIDERS} from 'angular2/http';
export class App {
constructor(public http: Http) { }
getThing() {
this.http.get('http://example.com')
.map(res => res.text())
.subscribe(
data => this.thing = data,
err => this.logError(err),
() => console.log('Complete')
);
}
}
More on this and how to use observables that get returned over here: https://auth0.com/blog/2015/10/15/angular-2-series-part-3-using-http/
:)