'use strict'; /** * @ngdoc directive * @name ngSanitize.directive:ngBindHtml * * @description * Creates a binding that will sanitize the result of evaluating the `expression` with the * {@link ngSanitize.$sanitize $sanitize} service and innerHTML the result into the current element. * * See {@link ngSanitize.$sanitize $sanitize} docs for examples. * * @element ANY * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate. */ angular.module('ngSanitize').directive('ngBindHtml', ['$sanitize', function($sanitize) { return function(scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.ngBindHtml); scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) { value = $sanitize(value); element.html(value || ''); }); }; }]);