Can you please elaborate on the issue with Philip's solution and your suggested fix?
Thanks, On Wednesday, June 19, 2013 4:47:32 PM UTC+3, Rafael Dipold wrote: > > Hi guys, > > The Phillip filter is nice but his function is called N times during the > iteration. > > I am reaching to this error: > > Error: 10 $digest() iterations reached. Aborting! > > So, I make some changes in your original filter to ( > http://jsbin.com/isagac/1/edit): > > angular.module('app', []) > .filter('inSlicesOf', > > ['$rootScope', > > function($rootScope) { > > makeSlices = function(items, count) { > > if (!count) > > count = 1; > > if (!angular.isArray(items) && !angular.isString(items)) return items; > > var array = []; > > for (var i = 0; i < items.length; i++) { > > var chunkIndex = parseInt(i / count, 10); > > var isFirst = (i % count === 0); > > if (isFirst) > > array[chunkIndex] = []; > > array[chunkIndex].push(items[i]); > > } > > > if (angular.equals($rootScope.arrayinSliceOf, array)) > > return $rootScope.arrayinSliceOf; > > else > > $rootScope.arrayinSliceOf = array; > > return array; > > }; > > return makeSlices; > > }] > > ); > -- 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.
