September 2014
Intermediate to advanced
256 pages
5h 25m
English
Now that you’ve built your API, it’s time to use it with Angular. Also, since Node is a web server, it’d be nice to get it to serve your HTML rather than load it as a flat file like you’ve been doing thus far.
To perform HTTP calls in Angular, you’ll use its built-in HTTP client: $http. If you haven’t noticed yet, official Angular components start with $. You should not prefix components you create with a $.
$http is a pretty standard HTTP client with some of the usual suspects: $http.get(), $http.post(), and so on. It is promise based.
Promises are a way of writing asynchronous code in JavaScript as an alternative to the traditional callback method that Node uses.
If you look ...