Angular pagination not updating when bound list changes due to filtering on an input text box

前端 未结 3 1325
时光说笑
时光说笑 2021-02-06 10:34

Here\'s the scenario:

I am using an ASP.NET MVC site with Angular JS and Boostrap UI. I have a dynamic ul list populated by data fed through a controller call to Angular

3条回答
  •  名媛妹妹
    2021-02-06 11:25

    Hello I tried to hook this up with Firebase using Angular Fire and it only works after I type something in the search input. In the $scope.$watch method, I used Angular Fire's orderByPriorityFilter to convert the object to an array.

    $scope.$watch('search', function(oldTerm, newTerm) {
      $scope.page = 1;
      // Use orderByPriorityFilter to convert Firebase Object into Array
      $scope.filtered = filterFilter(orderByPriorityFilter($scope.contacts), $scope.search);
      $scope.lastSearch.search = oldTerm;
      $scope.contactsCount = $scope.filtered.length;
    });
    

    Initial load doesn't load any contacts. It's only after I start typing in the input search field.

提交回复
热议问题