Muhammad Faizan Khan
Muhammad Faizan Khan

Reputation: 10561

how to disabled ionic slide box swap

I want to disable ionic Slide box Swap. i check many solutions this is worked with error.

$scope.stop = function() {
             $ionicSlideBoxDelegate.enableSlide(false);
            return false;
        };

added this thing to slide box

 <ion-slide-box active-slide="stop()">

it is working fine but as i click to content of ion slide box it will show me this error

 Error: [$compile:nonassign] Expression 'slidestop()' used with directive 'ionSlideBox' is non-assignable!

Upvotes: 1

Views: 1537

Answers (2)

Gaetan Senn
Gaetan Senn

Reputation: 9

You should use the $ionicView.loaded it's more clean compare to the $timeout

var destructor = $scope.$on('$ionicView.loaded', function () {
  $ionicSlideBoxDelegate.enableSlide(false);
  destructor();
};

Upvotes: 1

Nayan Dabhi
Nayan Dabhi

Reputation: 1006

In active-slide="stop()", you can't pass the function as argument, here you can pass the slide index which you have to active in slidebox.

Read more details from here Ionic Slidebox.

Add following code in controller to disabled the swipe effect from slidebox

$timeout(function(){
    $ionicSlideBoxDelegate.enableSlide(false);
},300);

I have tested in ionic application, there is bug if don't write your code in $timeout slidebox doesn't add the enableSlide() effect.

Upvotes: 0

Related Questions