diff options
| author | Vojta Jina | 2012-04-10 16:50:31 -0700 | 
|---|---|---|
| committer | Vojta Jina | 2012-04-11 15:50:47 -0700 | 
| commit | 5bcd7198664dca2bf85ddf8b3a89f417cd4e4796 (patch) | |
| tree | 3c9bde1e97e94a4af986019dbaea1eaa50a209d9 /src/ng/directive/ngBind.js | |
| parent | e1743cc837a51e3146f2e73e3083eee7f4a8f549 (diff) | |
| download | angular.js-5bcd7198664dca2bf85ddf8b3a89f417cd4e4796.tar.bz2 | |
chore(ngSanitize): extract $sanitize, ngBindHtml, linkyFilter into a module
Create build for other modules as well (ngResource, ngCookies):
- wrap into a function
- add license
- add version
Breaks `$sanitize` service, `ngBindHtml` directive and `linky` filter were moved to the `ngSanitize` module. Apps that depend on any of these will need to load `angular-sanitize.js` and include `ngSanitize` in their dependency list: `var myApp = angular.module('myApp', ['ngSanitize']);`
Diffstat (limited to 'src/ng/directive/ngBind.js')
| -rw-r--r-- | src/ng/directive/ngBind.js | 73 | 
1 files changed, 25 insertions, 48 deletions
| diff --git a/src/ng/directive/ngBind.js b/src/ng/directive/ngBind.js index 4f6d49aa..82402ae8 100644 --- a/src/ng/directive/ngBind.js +++ b/src/ng/directive/ngBind.js @@ -57,54 +57,6 @@ var ngBindDirective = ngDirective(function(scope, element, attr) {  /**   * @ngdoc directive - * @name angular.module.ng.$compileProvider.directive.ngBindHtmlUnsafe - * - * @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.ngBindHtml ngBindHtml} 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} ngBindHtmlUnsafe {@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) { -    element.html(value || ''); -  }); -}); - - -/** - * @ngdoc directive - * @name angular.module.ng.$compileProvider.directive.ngBindHtml - * - * @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} ngBindHtml {@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); -    scope.$watch(attr.ngBindHtml, function(value) { -      value = $sanitize(value); -      element.html(value || ''); -    }); -  } -}]; - - -/** - * @ngdoc directive   * @name angular.module.ng.$compileProvider.directive.ngBindTemplate   *   * @description @@ -160,3 +112,28 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {      });    }  }]; + + +/** + * @ngdoc directive + * @name angular.module.ng.$compileProvider.directive.ngBindHtmlUnsafe + * + * @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.ngBindHtml ngBindHtml} 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} ngBindHtmlUnsafe {@link guide/dev_guide.expressions Expression} to evaluate. + */ +var ngBindHtmlUnsafeDirective = [function() { +  return function(scope, element, attr) { +    element.addClass('ng-binding').data('$binding', attr.ngBindHtmlUnsafe); +    scope.$watch(attr.ngBindHtmlUnsafe, function(value) { +      element.html(value || ''); +    }); +  }; +}]; | 
