Chapter 8Interacting with REST APIs
Up to this point in our project, we've been storing all the blog posts
in a custom service. But in a real-world app, you'll need to store your data
in persistent storage: your server will normally expose a REST API, which
will enable you to perform CRUD operations on your app. In AngularJS, we
interact with these REST APIs using services such as
$http
and $resource
. But before you do
this, you need to be aware of a concept called
promises. This chapter will first introduce the
concept of promises and then explain how to work with REST APIs using
$http
and $resource
.
In the next chapter we'll revamp our demo app to use a REST back-end to store our blog posts. We'll also see how to unit test controllers that ...
Get AngularJS: Novice to Ninja now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.