Reputation: 2946
JSbin: http://jsbin.com/oxugef/1/edit
Im trying to slice an array to smaller subarrays and loop through them to create an evenly divided table of divs. If I understood correctly, I'm overwriting some model during loop, which results in unexpected insconsistencies. But I could not find which model is overwritten during loops.
This is an example of what i am trying to achieve:
data = {"key1": [1,2,3,4,...] //val1
, ...}
divs:
div.key1
div1,div2,div3,div4,div5
div6,div7,...
div.key2
div21,div22,div23,div24,div25
div26,div27,...
...
It lines up the divs as expected but the "...Aborting" error logs fill up the development console.
What am i doing wrong here, that results in this error?
Upvotes: 0
Views: 1334
Reputation: 54543
Please take a look at this stackoverfolow thread, you should make your filter to return the same exact objects since if the object get changed during the repeater, it will cause the error in $digest.
.filter("group", function () {
return _.memoize(function (items, count) {
var out = [],
temp = [];
for (var i = 0; i < items.length; i++) {
temp.push(items[i]);
if (temp.length == count) {
out.push(temp);
temp = [];
}
}
if (temp.length) out.push(temp);
return out;
});
});
Try it here jsbin
Upvotes: 1