@@ -23,7 +23,7 @@ var nullFormCtrl = {
23
23
*
24
24
* - keys are validation tokens (error names) — such as `required`, `url` or `email`),
25
25
* - values are arrays of controls or forms that are invalid with given error.
26
- *
26
+ *
27
27
* @description
28
28
* `FormController` keeps track of all its controls and nested forms as well as state of them,
29
29
* such as being valid/invalid or dirty/pristine.
@@ -62,6 +62,16 @@ function FormController(element, attrs) {
62
62
addClass ( ( isValid ? VALID_CLASS : INVALID_CLASS ) + validationErrorKey ) ;
63
63
}
64
64
65
+ /**
66
+ * @ngdoc function
67
+ * @name ng.directive:form.FormController#$addControl
68
+ * @methodOf ng.directive:form.FormController
69
+ *
70
+ * @description
71
+ * Register a control with the form.
72
+ *
73
+ * Input elements using ngModelController do this automatically when they are linked.
74
+ */
65
75
form . $addControl = function ( control ) {
66
76
controls . push ( control ) ;
67
77
@@ -70,6 +80,16 @@ function FormController(element, attrs) {
70
80
}
71
81
} ;
72
82
83
+ /**
84
+ * @ngdoc function
85
+ * @name ng.directive:form.FormController#$removeControl
86
+ * @methodOf ng.directive:form.FormController
87
+ *
88
+ * @description
89
+ * Deregister a control from the form.
90
+ *
91
+ * Input elements using ngModelController do this automatically when they are destroyed.
92
+ */
73
93
form . $removeControl = function ( control ) {
74
94
if ( control . $name && form [ control . $name ] === control ) {
75
95
delete form [ control . $name ] ;
@@ -81,6 +101,16 @@ function FormController(element, attrs) {
81
101
arrayRemove ( controls , control ) ;
82
102
} ;
83
103
104
+ /**
105
+ * @ngdoc function
106
+ * @name ng.directive:form.FormController#$setValidity
107
+ * @methodOf ng.directive:form.FormController
108
+ *
109
+ * @description
110
+ * Sets the validity of a form control.
111
+ *
112
+ * This method will also propagate to parent forms.
113
+ */
84
114
form . $setValidity = function ( validationToken , isValid , control ) {
85
115
var queue = errors [ validationToken ] ;
86
116
@@ -119,6 +149,17 @@ function FormController(element, attrs) {
119
149
}
120
150
} ;
121
151
152
+ /**
153
+ * @ngdoc function
154
+ * @name ng.directive:form.FormController#$setDirty
155
+ * @methodOf ng.directive:form.FormController
156
+ *
157
+ * @description
158
+ * Sets the form to a dirty state.
159
+ *
160
+ * This method can be called to add the 'ng-dirty' class and set the form to a dirty
161
+ * state (ng-dirty class). This method will also propagate to parent forms.
162
+ */
122
163
form . $setDirty = function ( ) {
123
164
element . removeClass ( PRISTINE_CLASS ) . addClass ( DIRTY_CLASS ) ;
124
165
form . $dirty = true ;
0 commit comments