我遇到的问题是它永远不会返回列表,我不知道为什么。它应该返回列表。也许我做错了什么。谢谢!
更新:现在它正在运作,但我的列表变为无限。它总是永远加载最后一个项目。使我的名单无限。
项目一览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));
// }
// };
}
})();
项-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)'}")