Highlights
- lazy render hidden fields: When enabled the components of hidden fields will not be present on the DOM which improves the rendering performance and avoid extra HTTP calls when used with the async pipe.
To enable this feature pass true
to lazyRender
options:
FormlyModule.forRoot({
+ extras: {
+ lazyRender: true,
+ },
}),
- reset field on hide: By default Formly model contains the value of hidden fields which is not convenient in some cases so we've introduced a new option
resetFieldOnHide
that detach the hidden field value from the main model.
To enable this feature pass true
to resetFieldOnHide
options:
FormlyModule.forRoot({
+ extras: {
+ resetFieldOnHide: true,
+ },
}),
- allow passing multiple errors from a single validator: To validate multiple fields with a single validator which is useful in dealing with server-side validation for an entire form section and display distinct error messages for each field.
export function customValidator() {
...
return {
passwordValidator: {
errorPath: 'password',
message: 'Please choose a stronger password!',
},
usernameValidator: {
errorPath: 'username',
message: 'This username is already taken!',
},
};
}
Bug Fixes
- core: avoid memory leakes for internal componentRefs (#2474) (e3d29e5), closes #2449
- core: share formControl for array field when key is duplicated (#2422) (8e461f4), closes #2420
- json-schema: avoid rely on default value for select oneOf item (#2431) (1c182bf), closes #2429
- json-schema: avoid reset on hide during the build step (#2426) (07fb1f6), closes #2420
- json-schema: support nested oneOf (#2428) (085f32c), closes #2403
- json-schema: take account of passing float to multipleOf validation (#2441) (f0ba4be), closes #2435
- material: apply a11y for validation messages (#2464) (c35a73b)
- material: remove empty mat-prefix and mat-suffix (#2444) (108fe95), closes #2443
- schematics: update angular-devkit deps (#2413) (6e232e1)
Features
- core: add option to resetFieldOnHide (#2476) (fff80de), closes #1847 #2381 #2439
- core: allow passing observable for expression asyncValidators (#2440) (dbbca7f)
- core: lazily render component field type (#2416) (429b3ec), closes #1215
- core: support form control for field with empty key (#2404) (3b47e0e), closes #2403
- core: support multiple errors from a single validator (#2392) (d12be59), closes #2378
- json-schema: allow passing mixed type in oneOf (#2425) (ce47591), closes #2420
- material: allow disable a single radio button (391257c)