Interacting with the Scope in Expressions
Now that you have seen some basic AngularJS expressions, let’s take a look at how to interact with the scope inside AngularJS expressions. In the previous example all the input for the expressions came from explicit strings or numbers. This example illustrates the true power of AngularJS expressions that come from interacting with the model.
The code in Listing 5.3 implements a basic AngularJS application with a controller. The controller contains the variables speed
, vehicle
, newSpeed
, and newVehicle
in the scope. It also includes three functions, upper
, lower
, and setValues
. These variables and functions are utilized in AngularJS expressions in the template shown in Listing 5.4.
The code in Listing ...
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.