assync 요청으로 채워진 이오니아 목록에 문제가 있습니다. 나는 다음과 같은 한 HTML에서Ionic 목록 assync 요청이있는 무한 스크롤 문제
: NG-초기화에서
<ion-list class="list" ng-init="setDateRange('today');" >
<!--IF NO ITEM IS FOUND -->
<ion-item class="listCenter" ng-if="listData.length == 0 || listData.length == null">
<h2>No data found, try to make few calls</h2>
</ion-item>
<ion-item class="item" ng-repeat="listDataItem in listData">
<!--HTML CONTENT OF ITEM REMOVED FROM EXAMPLE -->
</ion-item>
<ion-infinite-scroll
icon="ion-loading-c"
distance="10%"
on-infinite="setDateRange('past')">
</ion-infinite-scroll>
</ion-list>
은 데이터베이스 분리 방법에 assync 요청을 트리거하는 방법 setDateRange 방법이라고합니다.
나는이 문제가 다음과 같은 $ broadcast 메소드 scroll.infiniteScrollComplete의 구현에있을 수 있다고 생각합니다. 때문에 NG-초기화 동안
는$scope.updateList = function() {
console.log('Trying to update list');
$timeout(function() {
$scope.$apply(function() {
listData.forEach(function(item){
$scope.listData.push(item);
console.log("List length is "+ $scope.listData.length);
});
$ionicLoading.hide();
});
$scope.$broadcast('scroll.infiniteScrollComplete'); // should be removed in production
$scope.$broadcast('scroll.resize');
});
};
$scope.createList = function() {
console.log('Trying to render list');
alert("render");
$timeout(function() {
$scope.$apply(function() {
$scope.listData = listData;
console.log("List length is "+ $scope.listData.length);
});
// Infinite scroll broadcast should be here to avoid
// triggering of the on-infinite event
$scope.$broadcast('scroll.infiniteScrollComplete');
});
$ionicLoading.hide();
};
도 $ scope.listData이 순간에 존재하지 않기 때문에 할 수없는 방법 updateList을 트리거됩니다.
누군가는
$scope.$broadcast('scroll.infiniteScrollComplete')
및 올바른 방법으로
$scope.$broadcast('scroll.resize');
를 구현하는 방법을 말해 줄 수 있을까요?
도움 주셔서 감사합니다.
감사합니다. Jeremy .. – Dolo