|
4 | 4 | */ |
5 | 5 | var nullFormCtrl = { |
6 | 6 | $addControl: noop, |
7 | | - $getControls: noop, |
| 7 | + $getControls: valueFn([]), |
8 | 8 | $$renameControl: nullFormRenameControl, |
9 | 9 | $removeControl: noop, |
10 | 10 | $setValidity: noop, |
@@ -166,16 +166,18 @@ FormController.prototype = { |
166 | 166 | * @returns {Array} the controls that are currently part of this form |
167 | 167 | * |
168 | 168 | * @description |
169 | | - * This method returns a **shallow copy** of the controls that are currently part of this form |
170 | | - * ({@link form.FormController `FormController`} / |
171 | | - * {@link ngModel.NgModelController `NgModelController`}) . This can be used |
172 | | - * for example to iterate over all controls to validate them. |
| 169 | + * This method returns a **shallow copy** of the controls that are currently part of this form. |
| 170 | + * The controls can be instances of {@link form.FormController `FormController`} |
| 171 | + * ({@link ngForm "child-forms"}) and of {@link ngModel.NgModelController `NgModelController`}. |
| 172 | + * If you need access to the controls of child-forms, you have to call `$getControls()` |
| 173 | + * recursively on them. |
| 174 | + * This can be used for example to iterate over all controls to validate them. |
173 | 175 | * |
174 | | - * The controls can be accessed normally, but adding or removing controls from the array has no |
175 | | - * effect on the form. Instead, use {@link form.FormController#$addControl `$addControl()`} and |
176 | | - * {@link form.FormController#$removeControl `$removeControl()`}. |
177 | | - * Likewise, adding a control to / removing a control from the form is not reflected |
178 | | - * in the shallow copy. That means you should get a fresh copy from `$getControls` every time |
| 176 | + * The controls can be accessed normally, but adding to, or removing controls from the array has |
| 177 | + * no effect on the form. Instead, use {@link form.FormController#$addControl `$addControl()`} and |
| 178 | + * {@link form.FormController#$removeControl `$removeControl()`} for this use-case. |
| 179 | + * Likewise, adding a control to, or removing a control from the form is not reflected |
| 180 | + * in the shallow copy. That means you should get a fresh copy from `$getControls()` every time |
179 | 181 | * you need access to the controls. |
180 | 182 | */ |
181 | 183 | $getControls: function() { |
|
0 commit comments