Hi Johnny,
The only way to do this without caching is prepare the data in the
controller, before rendering it.
The reason it keeps on digesting is because every time you return a new set
of array’s, those are not known to angular, so angular goes forth and tags
it with an $id, which, in turn causes an digest wich.. (restart reading
this sentence!)
Ok, now you have broken out of the infinitive reading loop of above ;) I
will show you a more elegant, yet unusable option. This is one of the thing
that ES6 shines at.
this only works in FF or in chrome if you have set the “Enable Experimental
JavaScript” flag.
app.filter('partition', function() {
var mp = new Map();
var filter = function(arr, size,killCache) {
if (killCache) {mp.clear();}
if (!arr) { return; }
if (mp.has(size) && mp.get(size).has(arr)) {
return mp.get(size).get(arr);
}
var newArr = [];
for (var i=0; i<arr.length; i+=size) {
newArr.push(arr.slice(i, i+size));
}
if (!mp.has(size)) {
// new size item, create it!
mp.set(size,new WeakMap());
}
mp.get(size).set(arr,newArr);
return newArr;
};
return filter;
});
See it in action: http://jsbin.com/UmOMAgA/88/edit
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.