Reputation: 211
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)'}")
Upvotes: 2
Views: 96