خرید بک لینک

Vote count: 0

I have a custom filter:

controllers.filter('myFilter', function($document, $timeout) {
     retu function(items) {
     // Sort all by date
     items.sort(function(a, b) {
       retu (b.createdAt ? b.createdAt : b.start_time) - (a.createdAt ? a.createdAt : a.start_time);
     });

     var filtered = [];

      angular.forEach(items, function(item) {
        if(item.hasOwnProperty("accuracy")) {
          filtered.unshift(item);
        } else {
          if (!item.isHidden) {
              filtered.push(item);
          }
        }
      });

      retu filtered;
   };
});

This works all nice dandy, but produces an infinte digest loop if I retu only the top 10 results: retu filtered.splice(0, 10).

Why is this, and can I somehow only retu the top 10 without having this thing implode?

Also, oddly, if i use the filter elsewhere, THEN splice it, I still get an infinite digest error:

$filter('myFilter')(items).splice(0, 10);

Bizarre, right?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 20 خرداد 1395 ساعت: 10:12

صفحه بندی