我想要使用离子刷新的html页面,其中有3个div元素。每个div元素将执行不同的函数,如allShow()、earnedShow()和redeemShow()。
我使用popover组件来过滤我的数据。例如,“所有”将拥有所有数据,“赢得”将只显示已获得的详细信息,而“已赎回”将只显示已赎回的详细信息。我将所有视图都写在一个html本身中。我想要的是,当我在“挣来的”字段中,如果我试图拉出刷新页面意味着,只有对该div负责的函数才会出现,它不应该转到“All”
请提出一个如何使用这个的方法。
$scope.allShow = function()
{
$scope.All = true;
$scope.Earned = false;
$scope.Redeemed = false;
//some function
}
$scope.earnedShow = function()
{
$scope.All = false;
$scope.Earned = true;
$scope.Redeemed = false;
//some function
}
$scope.redeemShow = function()
{
$scope.All = false;
$scope.Earned = false;
$scope.Redeemed = true;
//some function
}
$scope.doRefresh = function() {
console.log('Refreshing!');
$timeout( function() {
// $scope.allShow();
$scope.allShow();
$scope.$broadcast('scroll.refreshComplete');
}, 500);
}; <ion-content scroll="true" >
<ion-refresher on-refresh="doRefresh()" pulling-text="Pull to refresh...">
</ion-refresher>
<div ng-show="All" >All
</div>
<div ng-show="Earned" >Earned
</div>
<div ng-show="Redeemed" >Redeemed
</div>
</ion-content>
发布于 2017-07-02 08:38:33
您应该根据当前选定的div刷新。有很多简单的解决方案,但是对于您的逻辑:
$scope.doRefresh = function() {
console.log('Refreshing!');
$timeout( function() {
if ($scope.All === true) {
$scope.allShow();
}
if ($scope.Earned === true) {
$scope.earnedShow();
}
if ($scope.Redeemed === true) {
$scope. redeemShow();
}
$scope.$broadcast('scroll.refreshComplete');
}, 500);可能是解决办法
https://stackoverflow.com/questions/44867847
复制相似问题