Disable swipe for one of the two slideboxes with same controller in ionic


#1

I have two ion slide boxes. One in state a and other in state b.

Both of them have same controller.

In the controller, I have

$scope.billsDetails=function(deploymentId,startingDate,name){

$rootScope.enableSwipe = false;
  $scope.$watch(function(){
return $rootScope.enableSwipe;
}, function() {
  console.log("watching" + $rootScope.enableSwipe)
       if(!$rootScope.enableSwipe){
        console.log("swipe not working")
 $ionicSlideBoxDelegate.enableSlide(false)
 }
 else if($rootScope.enableSwipe){
          console.log("swipe working")

     $rootScope.$broadcast('loading:hide')
    $ionicSlideBoxDelegate.enableSlide(true)
   }


   }, true);
}

Now, I intended to do it for slides in state b.

When I open the app, I am in state a, state a has ion slide box as well and it works fine.

I go to state b. It has swipe disabled initially and then in a couple of seconds it becomes enable. When I go back to state a now, the slide box has its swipe disabled.

Why is that? I have checked and rechecked that when I am going back to state a, enable swipe has been set to true already, How do I fix this?


#2

If you have two different controllers to two different states, then you should not face such issue. But i am still not sure how you are implementing this. You can try using two different delegators for the two sliders. As they have different references, then you should be able to manipulate as you wish. If possible, please provide a code snippet in a plunker or codepen. That would help understanding clearly.