O'Reilly logo

Node.js, MongoDB, and AngularJS Web Development by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Directives That Bind Page Events to Controllers

AngularJS templates enable you to bind browser events to controller code. This means you can handle user input from the scope’s perspective. You can then implement handlers for browser events directly to the appropriate scope. The event directive works very much like the normal browser event handlers, except that they are directly linked to the scope context.

Table 24.4 lists the directive that binds page and device events to the AngularJS model. Each of these directives allows you to specify an expression, which is typically a function defined in the scope, as discussed in Chapter 23, “Using AngularJS Templates to Create Views.” For example, the following is a function named setTitle in the scope: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required