Search code examples
angularjsangular-formly

Formly in ng-repeat breaks (due to duplicate IDs?)


I'm editing three records within a single form. The inputs on my elements end up with the same IDs, which breaks things like input validation.

http://plnkr.co/edit/TWXyUzx1Hasw5t36UiQ7?p=preview

Do I need to split these into separate forms? I tried overriding formlyConfig.extras.getFieldId to return distinct values, but formly insists on assigning the wrong IDs.


Solution

  • To use formly in a repeat, you need a different array of input for each iteration. Formly puts a bunch of stuff in there, it doesn't just read from it.