Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Upgrade

AngularJS ng-bind Directive


Bind the innerHTML of the <p> element to the variable myText:

<div ng-app="" ng-init="myText='Hello World!'">

<p ng-bind="myText"></p>

Try it Yourself »

Definition and Usage

The ng-bind directive tells AngularJS to replace the content of an HTML element with the value of a given variable, or expression.

If the value of the given variable, or expression, changes, the content of the specified HTML element will be changed as well.


<element ng-bind="expression"></element>

Or as a CSS class:

<element class="ng-bind: expression"></element>

Supported by all HTML elements.

Parameter Values

Value Description
expression Specifies a variable, or an expression to evaluate.