I'm submitting a ... (check one with "x")
[ ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[x] support request
Current behavior
If I set the list of fields statically, then everything works as it should. But if I load a list of fields from the server, then I get an error "Cannot find control with unspecified name attribute"
Expected behavior
Works without error.
Minimal reproduction of the problem with instructions
stackblitz
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
Windows 7 x64
npm 5.6.0
node 8.11.1
Angular version: 6.0.0
Browser: [Chrome XX]
Language: [TypeScript 2.7.2]
Node (for AoT issues): node --version =
you should return a new ref for the fields in order to take account of the new change which is required to build form again.
see https://stackblitz.com/edit/angular-yyy4rr
I wasted nearly an hour investigating this error. In my case i WAS returning a new ref as @aitboudad mentioned. Turns out it was a silly stupid typo. The model name (key property) was objectId instead of objectID. Hope this saves someone's time! :-)
Any tips on using provided solution with angular material drag & drop and it's function copyArrayItem? I see that copyArrayItem uses splice and if I'm writing something custom, instead of using this function, then it looses track of elements. https://github.com/angular/components/blob/master/src/cdk/drag-drop/drag-utils.ts#L62
I mean this wouldn't work Angular drag & drop, where field is new formly field:
event.container.data = [...event.container.data, field];
EDIT:
Continuing with this here https://github.com/ngx-formly/ngx-formly/issues/2083
Most helpful comment
you should return a new ref for the fields in order to take account of the new change which is required to build form again.
see https://stackblitz.com/edit/angular-yyy4rr