AngularJS ng-bind Directive
Definition and Usage
ng-bind
Directives inform AngularJS to replace the content of the HTML element with the value of the given variable or expression.
If the value of the given variable or expression changes, the content of the specified HTML element will also change.
If the value of the given variable or expression changes, the content of the specified HTML element will also change accordingly.
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>
Syntax
<element ng-bind="expression</element>
or as a CSS class:
<element class="ng-bind: expression</element>
All HTML elements support.
Parameters
Parameters | Description |
---|---|
expression | Specify the variable or expression to be calculated. |