Using Basic Expressions

In this exercise you get a chance to see how AngularJS expressions handle rendering of strings and numbers. The purpose of this exercise is to illustrate how AngularJS evaluates expressions that contain strings and numbers as well as basic mathematical operators.

The code in Listing 5.1 is just a simple AngularJS application with a controller named myController. The controller is empty because none of the expressions accesses the scope.

The code in Listing 5.2 is an AngularJS template that contains several types of expressions wrapped in {{}} brackets. Some of the expressions are just numbers or strings, some include the + operation to combine strings and/or numbers, and one applies a === operator to compare two numbers. ...

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.