Skip to Main Content
Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js
book

Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js

by Jeff Dickey
September 2014
Intermediate to advanced content levelIntermediate to advanced
256 pages
5h 25m
English
Peachpit Press
Content preview from Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js

Chapter 5. Integrating Node with Angular

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.

$http

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.

What Are Promises?

Promises are a way of writing asynchronous code in JavaScript as an alternative to the traditional callback method that Node uses.

If you look ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Node.js, MongoDB, and AngularJS Web Development

Node.js, MongoDB, and AngularJS Web Development

Brad Dayley

Publisher Resources

ISBN: 9780133962369Purchase book