Skip to content

Commit b0dc2fb

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 #67759 (cherry picked from commit 789c2cd)
1 parent ef204bd commit b0dc2fb

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
@@ -550,7 +550,8 @@ export abstract class AbstractControl<
550550
* with a key-value pair for each member of the group.
551551
* * For a disabled `FormGroup`, the values of all controls as an object
552552
* with a key-value pair for each member of the group.
553-
* * For a `FormArray`, the values of enabled controls as an array.
553+
* * For an enabled `FormArray`, the values of enabled controls as an array.
554+
* * For a disabled `FormArray`, the values of all controls as an array.
554555
*
555556
*/
556557
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)