Send Data via HTTP using Angular HttpParams

Share this video with your friends

Send Tweet

Obviously in a real world application we do not only fetch data from the backend, but we also send data to be stored permanently on the server side. The HttpClient gives us different options for achieving this. In this lesson we will look at how to attach parameters to our request URL, by manually concatenating the URL by ourselves, by using the HttpParams object and also how we can send entire objects in a POST request body.

Stephen
Stephen
~ 7 years ago

Im trying to follow along but your code is missing the proxy.config to allow the cli and express to work together. The code base seems to change every lesson BTW

Juri Strumpflohner
Juri Strumpflohner(instructor)
~ 7 years ago

Hey Stephen. Indeed, seems like the linked Plunker example isn't even the correct one for the lesson. Will contact the Egghead team and fix this.

Meanwhile you can use the GitHub companion repo for following along: https://github.com/juristr/egghead-learn-http-in-angular/tree/send-data-to-server.

I structured the repo with different branches that should be properly linked via the README.

The code base seems to change every lesson BTW

Yes, that might happen sometimes as the lessons might have been added later to the course as they're also intended to be consumed completely standalone. I'm sorry if that creates confusion for you. If you're stuck somewhere, feel free to ping me here or on Twitter (@juristr)

Stephen
Stephen
~ 7 years ago

Thanks, I actually figured it out from the cli docs! A really cool feature!

Juri Strumpflohner
Juri Strumpflohner(instructor)
~ 7 years ago

Yep indeed, very useful. We continuously use it in development 🙂