diff options
| author | Misko Hevery | 2011-12-14 02:55:31 +0100 |
|---|---|---|
| committer | Misko Hevery | 2012-01-25 11:53:59 -0800 |
| commit | 4804c83b7db5770d5d02eea9eea4cc012b4aa524 (patch) | |
| tree | be5ae1743179704cc1638f186cddba8d6e3fa37d /src/service/formFactory.js | |
| parent | e2b1d9e994e50bcd01d237302a3357bc7ebb6fa5 (diff) | |
| download | angular.js-4804c83b7db5770d5d02eea9eea4cc012b4aa524.tar.bz2 | |
docs(compiler): update the compiler docs
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) { |
