2

The problem I have is that it's never returning the list and I don't know why. It should return the list. Maybe I'm doing something wrong. Thanks!

UPDATE: NOW it's working but turned my list to infinite. It always load the last item forever. Makes my list infinite.

item-list-component.js

(function (){
  'use strict';

  angular
      .module('hotelsResult')
      .component('itemList', {
        controller: itemListController,
        bindings: {
            hotels: '<',
            filters: '<'
        },
        templateUrl: "hotel-result/item-list/item-list.html"
      });

      function itemListController (){
        let self = this;
        //this.images = [1, 2, 3, 4, 5, 6, 7, 8];
         this.loadMore = function () {
          let last = self.hotels[self.hotels.length - 1];
          console.log(self.hotels);
          console.log(last);
          for(let i=0 ; i<19; i++){
            self.hotels.push(last);
            i++;
          }
        }
        // this.loadMore = function() {
        //   var last = this.images[this.images.length - 1];
        //   for(var i = 0; i < 7; i++) {
        //     console.log(this.images.push(last + i));
        //   }
        // };
      }
})();

item-list.jade

ul(infinite-scroll="$ctrl.loadMore()" infinite-scroll-disabled="infiniteScorllStatus")
li(ng-repeat="hotel in $ctrl.filterResult = ($ctrl.hotels | filterHotel: $ctrl.filters.targetName | filterStar: $ctrl.filters.stars | filterNight: $ctrl.filters.price) track by $index")  
    item(item='hotel')
li(class="noResults" ng-show="!$ctrl.filterResult.length")
  .icon-ctn
    i.fa.fa-exclamation-circle(aria-hidden='true')  
  p Uy, no encontramos resultados. Podés cambiar o borrar los filtros.
li.noresultssvg(class="img-responsive" ng-show="!$ctrl.filterResult.length" ng-style="{'background-image':'url(/src/client/img/no-results.svg)'}")
Eugene Mihaylin
  • 1,208
  • 1
  • 10
  • 26
Pepper 92
  • 211
  • 1
  • 10
  • Hi, to help understand your problem, which library of infinite scroll are you using? This one https://sroze.github.io/ngInfiniteScroll/? – MathKimRobin May 14 '17 at 00:29
  • exactly! that one! I imported jquery before angular. And also imported ngInfiniteScroll.min.js – Pepper 92 May 14 '17 at 00:30

0 Answers0