Ngx-formly: Limit number of repeat type fields that can be added

Created on 29 Jul 2019  路  3Comments  路  Source: ngx-formly/ngx-formly

I'm submitting a ...

[ ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[X] support request

Expected behavior
Is there a way to limit the number of items that can be added using the repeat type? For instance, in the example on stackblitz you can click the ADD button as many times as you want, but I would like to limit it so that only up to 3 items can be added.

What is the motivation / use case for changing the behavior?
Sometimes a form needs to be able to add a specific number of user details, etc.

question

Most helpful comment

pass an extra option maxItems which you may use to conditionally hide the add button, check the following example https://stackblitz.com/edit/angular-5hxuzd

All 3 comments

pass an extra option maxItems which you may use to conditionally hide the add button, check the following example https://stackblitz.com/edit/angular-5hxuzd

@samwilliscreative, @aitboudad

Can you please clarify how this would work in a multi-field repeat scenario ?

Thanks

@argupta23 please fill a new issue with more details.
Thanks!

Was this page helpful?
0 / 5 - 0 ratings