AngularJS: nested ng-repeat (an array in an object) only works if there is one element in the array, and not when several

Ok, I have a strange problem. I have an array of objects. Each object contains a different array (of rows). I iterate over an array of objects using ng-repeat . Inside the repeating code, I ng-repeat over an array of strings. For some reason, this ng-repeat nested only works when the string array contains only one (1) element. When there are more items, it just doesn't work.

the code

Result <pre>{{ answer.value | json }}</pre> <pre>{{ answer.value | json }}</pre>

 [ "Apothekerskast", "Apothekerskast", "Koelkast ombouw" ] 

view (essentially because posting here causes markdown problems): https://gist.github.com/fabdrol/898e4ac9760fc358ce81

Data (in JSON), for readability: https://gist.github.com/fabdrol/089467fa09dad6e89e81

+2
source share
1 answer

He doesn't like duplicates , use track by $index :

ng-repeat="val in vals track by $index"

JSFiddle: http://jsfiddle.net/nedq13q2/

+3
source

Source: https://habr.com/ru/post/1206242/


All Articles