ionic 刷新相關的問題
1、下拉刷新
HTML:
<ion-content>
<ion-refresher on-refresh ="doRefresh()">
<ion-refresher-content
pullingIcon="arrow-dropdown"
pullingText="下拉刷新..."
refreshingSpinner="circles"
refreshingText="Refreshing...">
</ion-refresher-content>
</ion-refresher>
</ion-content>
JavaScript:
$scope.doRefresh=function(){
//函數執行結束之前必須廣播下該事件結束
$scope.$broadcast(‘scroll.refreshComplete‘);
};
2、觸底加載
HTML:
<ion-content>
<ion-list>
……
</ion-list>
<ion-infinite-scroll on-infinite="doInfinite()">
<ion-infinite-scroll-content
loadingSpinner="bubbles"
loadingText=“正在加載……">
</ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content>
JavaScript:
$scope.doInfinite=function(){
//需要廣播事件結束
$scope.$broadcast(‘scroll.infiniteScrollComplete‘);
};
3、局部刷新代碼
$scope.$on(‘$ionicView.beforeEnter‘){
$scope.doRefresh();
}
ionic 刷新相關的問題