AngularJS ng-bind-html
Directive
AngularJS Example
Bind the innerHTML of a <p> element to the variable myText:
Definition and Usage
The ng-bind-html directive binds content to an HTML element in a secure way.
When you want AngularJS to write HTML in your application, you need to detect some dangerous code. By including the "angular-sanitize.js" module in your application and using the ngSanitize function to check the code for safety.
Syntax
This directive is supported by all HTML elements.
Parameter Values
Value | Description |
---|---|
expression | Specifies the variable or expression to be evaluated. |