diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/directives.js | 31 | ||||
| -rw-r--r-- | src/service/sanitize.js | 2 | ||||
| -rw-r--r-- | src/widgets.js | 2 |
3 files changed, 33 insertions, 2 deletions
diff --git a/src/directives.js b/src/directives.js index 1fc7f1b5..91241a16 100644 --- a/src/directives.js +++ b/src/directives.js @@ -196,6 +196,22 @@ var ngBindDirective = ngDirective(function(scope, element, attr) { }); }); + +/** + * @ngdoc directive + * @name angular.module.ng.$compileProvider.directive.ng:bind-html-unsafe + * + * @description + * Creates a binding that will innerHTML the result of evaluating the `expression` into the current + * element. *The innerHTML-ed content will not be sanitized!* You should use this directive only if + * {@link angular.module.ng.$compileProvider.directive.ng:bind-html ng:bind-html} directive is too + * restrictive and when you absolutely trust the source of the content you are binding to. + * + * See {@link angular.module.ng.$sanitize $sanitize} docs for examples. + * + * @element ANY + * @param {expression} expression {@link guide/dev_guide.expressions Expression} to evaluate. + */ var ngBindHtmlUnsafeDirective = ngDirective(function(scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.ngBindHtmlUnsafe); scope.$watch(attr.ngBindHtmlUnsafe, function(value) { @@ -203,6 +219,21 @@ var ngBindHtmlUnsafeDirective = ngDirective(function(scope, element, attr) { }); }); + +/** + * @ngdoc directive + * @name angular.module.ng.$compileProvider.directive.ng:bind-html + * + * @description + * Creates a binding that will sanitize the result of evaluating the `expression` with the + * {@link angular.module.ng.$sanitize $sanitize} service and innerHTML the result into the current + * element. + * + * See {@link angular.module.ng.$sanitize $sanitize} docs for examples. + * + * @element ANY + * @param {expression} expression {@link guide/dev_guide.expressions Expression} to evaluate. + */ var ngBindHtmlDirective = ['$sanitize', function($sanitize) { return function(scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.ngBindHtml); diff --git a/src/service/sanitize.js b/src/service/sanitize.js index 1e201691..1446487c 100644 --- a/src/service/sanitize.js +++ b/src/service/sanitize.js @@ -63,7 +63,7 @@ </tr> <tr id="escaped-html"> <td>no filter</td> - <td><pre><div ng:bind-="snippet"><br/></div></pre></td> + <td><pre><div ng:bind="snippet"><br/></div></pre></td> <td><div ng:bind="snippet"></div></td> </tr> <tr id="html-unsafe-filter"> diff --git a/src/widgets.js b/src/widgets.js index d3b4083f..235fbc2b 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -805,7 +805,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interp restrict: 'EA', link: function(scope, element, attr) { var numberExp = attr.count, - whenExp = element.attr(attr.$attr.when), // this is becaues we have {{}} in attrs + whenExp = element.attr(attr.$attr.when), // this is because we have {{}} in attrs offset = attr.offset || 0, whens = scope.$eval(whenExp), whensExpFns = {}; |
