angular-cn/packages/forms/src
Andrew Kushnir c9fe455fa2 fix(forms): allow `patchValue()` method of `FormGroup` and `FormArray` classes to skip `null` values (#40534)
Prior to this commit, the `patchValue()` of the `FormGroup` and `FormArray` classes used to throw an exception
when the `value` argument contained a data structure that has `null` or `undefined` as a value for a field
that represents an instance of `FormGroup` or `FormArray` (for `FormControl` it's not a problem, since it
doesn't have nested controls), since the `patchValue()` method tried to iterate over provided values to
match current data structure.

This commit updates the `patchValue()` logic in `FormGroup` and `FormArray` classes to just ignore `null` and
`undefined` values (without any changes to corresponding `FormGroup` and `FormArray` instances). This
behavior looks inline with the `patchValue()` method goal of "doing its best to match the values to the
correct controls" (quote from docs).

Fixes #36672.
Fixes #21021.

PR Close #40534
2021-01-25 11:42:26 -08:00
..
directives fix(forms): properly cleanup in cases when FormControlName has no CVA (#40526) 2021-01-25 11:41:14 -08:00
directives.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
form_builder.ts docs: improve FormBuilder.group deprecation message (#39946) 2020-12-04 10:18:48 -08:00
form_providers.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
forms.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
model.ts fix(forms): allow `patchValue()` method of `FormGroup` and `FormArray` classes to skip `null` values (#40534) 2021-01-25 11:42:26 -08:00
validators.ts docs(forms): typo word "property" was missing (#40323) 2021-01-06 08:44:03 -08:00
version.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00