This article mainly introduces how to solve the problem of ionic and angular pull-up loading. Friends who need it can refer to it
When it comes to ionic pull-up loading, it is the same as PC paging. It needs to be in html Add
1 2 | <ion-infinite-scroll ng- if = "hasmore" on-infinite= "loadMore()" distance= "10%" >
</ion-infinite-scroll>
|
Copy after login
at the bottom of the data list. When the list is empty and ng-if is true, and the list is not filled, it will automatically load loadMore( );
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <span style= "font-size:18px;" > $scope .loadMore = function () {
Msdk.postJSON('/informNotice/queryNoticeInfo', {
pageIndex: $scope .newsList.pageIndex,
pageSize: $scope .newsList.pageSize,
informIds: $scope .newsList.informIds
},
function (e) {
if (e.length != 0) {
var a = $scope .notice;
$scope .notice = a.concat(e);
console.log( $scope .notice);
$scope . $broadcast ('scroll.infiniteScrollComplete'); $scope .newsList.pageIndex++;</span>
|
Copy after login
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <span style= "font-size:18px;" >
<span style= "font-size:18px;" ><span style= "white-space:pre" > </span>
if (e.length < $scope .newsList.pageSize) {
$scope .hasmore = false;
} else {</span>
[javascript] view plain copy
<span style= "font-size:18px;" ><span style= "white-space:pre" > </span>
$scope .hasmore = true;
}
} else {
$scope .hasmore = false;
$scope . $broadcast ('scroll.infiniteScrollComplete');
}
})
}</span>
|
Copy after login
The above is the detailed content of Solution to ionic and angular pull-up loading problem. For more information, please follow other related articles on the PHP Chinese website!