AngularJS ng-bindDirective
AngularJS Example
Bind the innerHTML inside <p> to a variablemyText:
<div ng-app="" ng-init="myText='Hello World!'">
<p ng-bind="myText"></p>
</div>
<p ng-bind="myText"></p>
</div>
Try it Yourself »
Definition and Usage
ng-bindThe directive tells AngularJS to replace the content of an HTML element with the value of a given variable or expression.
If the given variable or expression is modified, the specified HTML element will also be modified.
Syntax
<element ng-bind="expression"></element>
Or as a CSS class:
<element class="ng-bind: expression"></element>
All HTML elements support this directive.
Parameter Value
| Value | Description |
|---|---|
| expression | Specifies the variable or expression to be executed. |
Other Extensions
AngularJS Reference Manual