Skip to content

Commit 789c2cd

Browse files
angular-bootstrapatscott
authored andcommitted
docs(forms): clarify disabled FormArray value behavior
Document that FormArray.value includes only enabled child controls when the array is enabled, but includes all child values when the FormArray itself is disabled. Fixes angular#67759
1 parent 24c5400 commit 789c2cd

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

packages/forms/src/model/abstract_model.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ export abstract class AbstractControl<
554554
* with a key-value pair for each member of the group.
555555
* * For a disabled `FormGroup`, the values of all controls as an object
556556
* with a key-value pair for each member of the group.
557-
* * For a `FormArray`, the values of enabled controls as an array.
557+
* * For an enabled `FormArray`, the values of enabled controls as an array.
558+
* * For a disabled `FormArray`, the values of all controls as an array.
558559
*
559560
*/
560561
public readonly value!: TValue;

packages/forms/src/model/form_array.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ export type ɵFormArrayRawValue<T extends AbstractControl<any>> = ɵTypedOrUntyp
5454
*
5555
* A `FormArray` aggregates the values of each child `FormControl` into an array.
5656
* It calculates its status by reducing the status values of its children. For example, if one of
57-
* the controls in a `FormArray` is invalid, the entire array becomes invalid.
57+
* the controls in a `FormArray` is invalid, the entire array becomes invalid. Similarly, if all
58+
* controls in a `FormArray` are disabled, the entire array becomes disabled.
5859
*
5960
* `FormArray` accepts one generic argument, which is the type of the controls inside.
6061
* If you need a heterogenous array, use {@link UntypedFormArray}.

0 commit comments

Comments
 (0)