| OLD | NEW |
| (Empty) |
| 1 part of angular.directive; | |
| 2 | |
| 3 /** | |
| 4 * Creates a binding that will innerHTML the result of evaluating the | |
| 5 * `expression` bound to `ng-bind-html` into the current element in a secure | |
| 6 * way. This expression must evaluate to a string. The innerHTML-ed content | |
| 7 * will be sanitized using a default [NodeValidator] constructed as `new | |
| 8 * dom.NodeValidatorBuilder.common()`. In a future version, when Strict | |
| 9 * Contextual Escaping support has been added to Angular.dart, this directive | |
| 10 * will allow one to bypass the sanitizaton and innerHTML arbitrary trusted | |
| 11 * HTML. | |
| 12 * | |
| 13 * Example: | |
| 14 * | |
| 15 * <div ng-bind-html="htmlVar"></div> | |
| 16 */ | |
| 17 @NgDirective( | |
| 18 selector: '[ng-bind-html]', | |
| 19 map: const {'ng-bind-html': '=>value'}) | |
| 20 class NgBindHtmlDirective { | |
| 21 final dom.Element element; | |
| 22 final dom.NodeValidator validator; | |
| 23 | |
| 24 NgBindHtmlDirective(this.element, dom.NodeValidator this.validator); | |
| 25 | |
| 26 /** | |
| 27 * Parsed expression from the `ng-bind-html` attribute. The result of this | |
| 28 * expression is innerHTML'd according to the rules specified in this class' | |
| 29 * documentation. | |
| 30 */ | |
| 31 set value(value) => element.setInnerHtml(value == null ? '' : value.toString()
, | |
| 32 validator: validator); | |
| 33 } | |
| OLD | NEW |