diff --git a/angularFiles.js b/angularFiles.js
index af8594710e57..af38755cd575 100644
--- a/angularFiles.js
+++ b/angularFiles.js
@@ -23,7 +23,6 @@ angularFiles = {
'src/service/filter/filters.js',
'src/service/filter/limitTo.js',
'src/service/filter/orderBy.js',
- 'src/service/formFactory.js',
'src/service/interpolate.js',
'src/service/location.js',
'src/service/log.js',
diff --git a/docs/content/api/angular.inputType.ngdoc b/docs/content/api/angular.inputType.ngdoc
index 9cbf9eb2cda0..a5d1f74aa214 100644
--- a/docs/content/api/angular.inputType.ngdoc
+++ b/docs/content/api/angular.inputType.ngdoc
@@ -32,61 +32,3 @@ All `inputType` widgets support:
- **`ng:pattern`** Sets `PATTERN` validation error key if the value does not match the
RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
patterns defined as scope expressions.
-
-
-
-# Example
-
-
-
-
-
-
-
-
-
- it('should invalidate on wrong input', function() {
- expect(element('form[name=myForm]').prop('className')).toMatch('ng-valid');
- input('data').enter('{}');
- expect(binding('data')).toEqual('{}');
- input('data').enter('{');
- expect(element('form[name=myForm]').prop('className')).toMatch('ng-invalid');
- });
-
-
diff --git a/docs/content/cookbook/advancedform.ngdoc b/docs/content/cookbook/advancedform.ngdoc
index 58a8dfd52cbb..3e3b2d288276 100644
--- a/docs/content/cookbook/advancedform.ngdoc
+++ b/docs/content/cookbook/advancedform.ngdoc
@@ -52,7 +52,7 @@ detection, and preventing invalid form submission.
};
$scope.isSaveDisabled = function() {
- return $scope.myForm.$invalid || angular.equals(master, $scope.form);
+ return $scope.myForm.invalid || angular.equals(master, $scope.form);
};
$scope.cancel();
diff --git a/docs/content/guide/dev_guide.forms.ngdoc b/docs/content/guide/dev_guide.forms.ngdoc
index 5a6fe54e5948..97d82bb1469a 100644
--- a/docs/content/guide/dev_guide.forms.ngdoc
+++ b/docs/content/guide/dev_guide.forms.ngdoc
@@ -138,7 +138,7 @@ The following example demonstrates:
};
$scope.isSaveDisabled = function() {
- return $scope.userForm.$invalid || angular.equals($scope.master, $scope.form);
+ return $scope.userForm.invalid || angular.equals($scope.master, $scope.form);
};
$scope.cancel();
@@ -150,7 +150,7 @@ The following example demonstrates:
-
+
Customer name is required!
@@ -165,15 +165,15 @@ The following example demonstrates:
-
+
Incomplete address:
-
+
Missing state!
-
+
Invalid state!
-
+
Missing zip!
-
+
Invalid zip!
@@ -284,56 +284,38 @@ This example shows how to implement a custom HTML editor widget in Angular.
$scope.htmlContent = 'HelloWorld!';
}
- HTMLEditorWidget.$inject = ['$scope', '$element', '$sanitize'];
- function HTMLEditorWidget(scope, element, $sanitize) {
- scope.$parseModel = function() {
- // need to protect for script injection
- try {
- scope.$viewValue = $sanitize(
- scope.$modelValue || '');
- if (this.$error.HTML) {
- // we were invalid, but now we are OK.
- scope.$emit('$valid', 'HTML');
- }
- } catch (e) {
- // if HTML not parsable invalidate form.
- scope.$emit('$invalid', 'HTML');
- }
- }
+ angular.module('formModule', []).directive('ngHtmlEditor', function ($sanitize) {
+ return {
+ require: 'ngModel',
+ link: function(scope, elm, attr, ctrl) {
+ attr.$set('contentEditable', true);
- scope.$render = function() {
- element.html(this.$viewValue);
- }
+ ctrl.$render = function() {
+ elm.html(ctrl.viewValue);
+ };
- element.bind('keyup', function() {
- scope.$apply(function() {
- scope.$emit('$viewChange', element.html());
- });
- });
- }
+ ctrl.formatters.push(function(value) {
+ try {
+ value = $sanitize(value || '');
+ ctrl.emitValidity('HTML', true);
+ } catch (e) {
+ ctrl.emitValidity('HTML', false);
+ }
+
+ });
- angular.module('formModule', [], function($compileProvider){
- $compileProvider.directive('ngHtmlEditorModel', function ($formFactory) {
- return function(scope, element, attr) {
- var form = $formFactory.forElement(element),
- widget;
- element.attr('contentEditable', true);
- widget = form.$createWidget({
- scope: scope,
- model: attr.ngHtmlEditorModel,
- controller: HTMLEditorWidget,
- controllerArgs: {$element: element}});
- // if the element is destroyed, then we need to
- // notify the form.
- element.bind('$destroy', function() {
- widget.$destroy();
+ elm.bind('keyup', function() {
+ scope.$apply(function() {
+ ctrl.read(elm.html());
+ });
});
- };
- });
+
+ }
+ };
});