How to Send Data with POST Requests in Ionic 2
In the past, we have covered how to make a simple GET request to load data from a server, and for the most part, making a POST request is pretty much the same.
There are a few key differences, though, including the fact that a POST request also includes a body, and there's also a feature that is built into observables that may trip you up when attempting to make a POST request. In this video tutorial, we walk through a basic example of sending a POST request to a server in Ionic 2.
Here's the video:
- POST requests are similar to GET requests, but a POST request also contains a body with data
- You can import Headers and add them to your POST requests to specify things like Content-Type
- Observables are "lazy", so if you don't subscribe to your POST requests they will never be executed