1cfa79ca4e
This commit introduces a new option to template-driven forms that improves performance by delaying form control updates until the "blur" or "submit" event. To use it, set the `updateOn` property in `ngModelOptions`. ```html <input ngModel [ngModelOptions]="{updateOn: blur}"> ``` Like in AngularJS, setting `updateOn` to `blur` or `submit` will delay the update of the value as well as the validation status. Updating value and validity together keeps the system easy to reason about, as the two will always be in sync. It's also worth noting that the value/validation pipeline does still run when the form is initialized (in order to support initial values). Upcoming PRs will address: * Support for setting group-level `updateOn` in template-driven forms * Option for skipping initial validation run or more global error display configuration * Better support of reactive validation strategies See more context in #18408, #18514, and the [design doc](https://docs.google.com/document/d/1dlJjRXYeuHRygryK0XoFrZNqW86jH4wobftCFyYa1PA/edit#heading=h.r6gn0i8f19wz). |
||
---|---|---|
.. | ||
directives_spec.ts | ||
form_array_spec.ts | ||
form_builder_spec.ts | ||
form_control_spec.ts | ||
form_group_spec.ts | ||
reactive_integration_spec.ts | ||
spies.ts | ||
template_integration_spec.ts | ||
validators_spec.ts | ||
value_accessor_integration_spec.ts |