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 6.4 lists the directives that bind page and device events to the AngularJS model. Each of these directives enables you to specify an expression, which is typically a function defined in the scope, as discussed in Chapter 5, “Using AngularJS Templates to Create Views.” For example, the following is a function named setTitle in the scope: ...

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.