$http is an AngularJS service for reading data from remote servers.
The AngularJS $http
service makes a request to the server, and returns a response.
The response received from the server using the $http
service is an object containing several useful properties:
These properties help you manage and handle server responses effectively in your AngularJS application.
errors
, add one more functions to the .then method:The data you get from the response is expected to be in JSON format.
JSON is a great way of transporting data, and it is easy to use within AngularJS, or any other JavaScript.
Example: On the server we have a file that returns a JSON object containing 15 customers, all wrapped in an array called records
.