O'Reilly logo

Learning AngularJS 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 the Model to Page Elements

AngularJS templates enable you to bind data in the scope directly to what is displayed in HTML elements. You can bind data to the view in several ways, including these:

Value: You can directly represent the value of a form element in the scope. For example, a text input can be a String variable in the scope, but a check box would be represented by a Boolean value.

HTML: You can represent the value of data in the scope in the HTML output of an element by using expressions such as this:

<p>{{myTitle}}</p>

Attributes: The value of HTML element attributes can reflect the data in the scope by using expressions in the definition such as this:

<a ng-href="/{{hash}}/index.html">{{hash}}</a>. ...

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