Angular 2 Tutorial (2016) - HTTP (GET and POST to RESTful Service)
Why Stack Overflow recommends it
Stack Overflow users link it as a worked example of making Angular 2 HTTP calls and of using services to supply data to components, though it targets the 2016 beta API.
Recommended by 1 people across 1 different months, 2016 to 2017.
What it is
A 22-minute Angular 2 beta tutorial from Academind (Maximilian Schwarzmuller) showing how to use the Http service to send GET and POST requests to a RESTful service and handle the responses. It is one episode in a longer Angular 2 introduction series with source code on GitHub.
What people said
Recommends sancelot · 2017-08 · Stack Overflow · on “Create a component with attributes to bind data”
You have to setup an angular service that will be a dataprovider for each component you are using. you inject the service in each component. read this video [this video]
Cites napstablook · 2016-04 · Stack Overflow · on “Difficulty creating a functional Angular2 post”
I'm trying to send a post request to another service (a Spring application), an authentication, but I'm having trouble constructing a functional Angular2 post request at all. I'm using this video [this video] for reference, which is pretty new, so I assume the information still valid. I'm also able to execute a get request with no problems. Here's my post request: export class LogIn { authUser: string; authPass: string; token: any; constructor(private _http:Http){} onSubmit() { var header = new Headers() var json = JSON.stringify({ user: this.authUser, password: this.authPass }) var params2 = 'user=' + this.authUser + '&password=' + this.authPass var params = "json=" + json header.append('Content
Cites NickJ · 2017-02 · Stack Overflow · on “Directives in an Angular2 Component”
I am trying to follow this tutorial : [this video] on using HTTP Rest calls in an Angular 2 application. When I reach the point of including the directives in the @Component annotation, I get this error: Argument of type '{ selector: string; templateUrl: string; directives: typeof HttpTestComponent[]; }' is not assignable to parameter of type 'Component'. Object literal may only specify known properties, and 'directives' does not exist in type 'Component'. I don't know what exact version of Angular2 I'm using, neither to I know how to find out, bit is this likely down to an incompatibility between the version used in the tutorial, and my version? How can I get past this?