ngx-formly / ngx-formly

📝 JSON powered / Dynamic forms for Angular
https://formly.dev
MIT License
2.8k stars 562 forks source link

Nested array ignores default value #3974

Closed jma closed 2 months ago

jma commented 2 months ago

Description When an array contains an array, the default value is ignored.

Minimal Reproduction

In the following example an array at the root level takes the default value into account. The "Nested Array2" don't. https://stackblitz.com/edit/angular-hb4vkw?file=src%2Fassets%2Fjson-schema%2Farrays.json

Your Environment

Many thanks in advanced.

aitboudad commented 2 months ago

Default value is only set when the value is undefined, if pass undefined or empty object default: [{}] to array1 it should work.

aitboudad commented 2 months ago

https://stackblitz.com/edit/angular-hb4vkw-qjzp8n?file=src%2Fassets%2Fjson-schema%2Farrays.json