The Relationship Between Scope and Back-End Server Data

Often data that is used for an AngularJS application comes from a back-end data source such as a database. In such instances, the scope still acts as the definitive source of data for the AngularJS application. You should use the following rules when interacting with data that is coming from the server side:

■ Access data from the database or other back-end sources via AngularJS services, which are discussed in Chapter 9, “Implementing AngularJS Services in Web Applications.” This includes both reading and updating data.

■ Ensure that data read from the server updates the scope, which in turn updates the view. Avoid the temptation to manipulate the HTML values directly from the database, ...

Get Learning AngularJS 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.