feat(forms): add updateOn submit option to FormControls (#18514)
This commit is contained in:
@ -134,6 +134,7 @@ export class FormGroupDirective extends ControlContainer implements Form,
|
||||
|
||||
onSubmit($event: Event): boolean {
|
||||
this._submitted = true;
|
||||
this._syncPendingControls();
|
||||
this.ngSubmit.emit($event);
|
||||
return false;
|
||||
}
|
||||
@ -145,6 +146,16 @@ export class FormGroupDirective extends ControlContainer implements Form,
|
||||
this._submitted = false;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_syncPendingControls() {
|
||||
this.form._syncPendingControls();
|
||||
this.directives.forEach(dir => {
|
||||
if (dir.control._updateOn === 'submit') {
|
||||
dir.viewToModelUpdate(dir.control._pendingValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_updateDomValue() {
|
||||
this.directives.forEach(dir => {
|
||||
|
Reference in New Issue
Block a user