CHAPTER 13

image

Using Controllers and Scopes

In this chapter, I describe the relationship between controllers and scopes and demonstrate how to use both to best effect. Scopes are more complex than they first appear and—as you’ll learn—form a hierarchy that can be used to communicate between controllers. I’ll also show you how can create controllers that don’t use scopes and how you can use scopes to integrate AngularJS with other JavaScript frameworks. Table 13-1 summarizes this chapter.

Table 13-1. Chapter Summary

Problem

Solution

Listing

Create a controller.

Use the Module.controller method to define a controller and apply it to an HTML ...

Get Pro 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.