AngularJS ng-bind
Directive
AngularJS 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>
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 given variable or expression changes, the specified HTML element will be updated accordingly.
Syntax
Or as a CSS class:
This directive is supported by all HTML elements.
Parameter Values
Value | Description |
---|---|
expression | Specifies the variable or expression to be evaluated. |