mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
docs: add a callout that adding/removing to formArray doesn't not mark dirty (#64337)
fixes #36788 PR Close #64337
This commit is contained in:
parent
dc37100538
commit
2ecbc4e643
1 changed files with 6 additions and 0 deletions
|
|
@ -174,6 +174,8 @@ export class FormArray<TControl extends AbstractControl<any> = any> extends Abst
|
|||
* * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
|
||||
* `valueChanges` observables emit events with the latest status and value when the control is
|
||||
* inserted. When false, no events are emitted.
|
||||
*
|
||||
* NOTE: Pushing to the FormArray will not mark it dirty. If you want to mark if dirty, call `markAsDirty()`.
|
||||
*/
|
||||
push(control: TControl | Array<TControl>, options: {emitEvent?: boolean} = {}): void {
|
||||
if (Array.isArray(control)) {
|
||||
|
|
@ -201,6 +203,8 @@ export class FormArray<TControl extends AbstractControl<any> = any> extends Abst
|
|||
* * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
|
||||
* `valueChanges` observables emit events with the latest status and value when the control is
|
||||
* inserted. When false, no events are emitted.
|
||||
*
|
||||
* NOTE: Inserting to the FormArray will not mark it dirty. If you want to mark if dirty, call `markAsDirty()`.
|
||||
*/
|
||||
insert(index: number, control: TControl, options: {emitEvent?: boolean} = {}): void {
|
||||
this.controls.splice(index, 0, control);
|
||||
|
|
@ -220,6 +224,8 @@ export class FormArray<TControl extends AbstractControl<any> = any> extends Abst
|
|||
* * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
|
||||
* `valueChanges` observables emit events with the latest status and value when the control is
|
||||
* removed. When false, no events are emitted.
|
||||
*
|
||||
* NOTE: Removing the FormArray will not mark it dirty. If you want to mark if dirty, call `markAsDirty()`.
|
||||
*/
|
||||
removeAt(index: number, options: {emitEvent?: boolean} = {}): void {
|
||||
// Adjust the index, then clamp it at no less than 0 to prevent undesired underflows.
|
||||
|
|
|
|||
Loading…
Reference in a new issue