diff options
Diffstat (limited to 'src/service/formFactory.js')
| -rw-r--r-- | src/service/formFactory.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/service/formFactory.js b/src/service/formFactory.js index 727a243c..807f4113 100644 --- a/src/service/formFactory.js +++ b/src/service/formFactory.js @@ -22,26 +22,27 @@ * This example shows how one could write a widget which would enable data-binding on * `contenteditable` feature of HTML. * - <doc:example> + <doc:example module="formModule"> <doc:source> <script> function EditorCntl($scope) { - $scope.html = '<b>Hello</b> <i>World</i>!'; + $scope.htmlContent = '<b>Hello</b> <i>World</i>!'; } - HTMLEditorWidget.$inject = ['$element', '$scope', 'htmlFilter']; - function HTMLEditorWidget(element, scope, htmlFilter) { + HTMLEditorWidget.$inject = ['$scope', '$element', '$sanitize']; + function HTMLEditorWidget(scope, element, $sanitize) { scope.$parseModel = function() { // need to protect for script injection try { - this.$viewValue = htmlFilter(this.$modelValue || '').get(); + scope.$viewValue = $sanitize( + scope.$modelValue || ''); if (this.$error.HTML) { // we were invalid, but now we are OK. - this.$emit('$valid', 'HTML'); + scope.$emit('$valid', 'HTML'); } } catch (e) { // if HTML not parsable invalidate form. - this.$emit('$invalid', 'HTML'); + scope.$emit('$invalid', 'HTML'); } } @@ -128,7 +129,7 @@ function $FormFactoryProvider() { * Static method on `$formFactory` service. * * Retrieve the closest form for a given element or defaults to the `root` form. Used by the - * {@link angular.widget.form form} element. + * {@link angular.module.ng.$compileProvider.directive.form form} element. * @param {Element} element The element where the search for form should initiate. */ formFactory.forElement = function(element) { |
