THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

AngularJS ng-bind Directive


Example

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

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

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

</div>
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.


Syntax

<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.