Disable scrolling in the ion slide

In ion mode, we have slideBox.I want to disable scrolling. I want it to slide at the click of a button. How can i do this?

I tried $ionicSlideBoxDelegate.enableSlide(false)in my controller, but it does not work.

According to this link http://forum.ionicframework.com/t/ionicslideboxdelegate-disable-all-swiping/6391 I need to disable in the slide area, but how to access the scope of the element and apply it?

+4
source share
4 answers

The right place for this is ng-init

<ion-slide-box ng-init="lockSlide()">

and have the appropriate function in your controller

.controller('sliders', function($scope, $ionicSlideBoxDelegate) {
    $scope.lockSlide = function () {
        $ionicSlideBoxDelegate.enableSlide( false );
    }
}
+10
source

html active-slide = "slidestop ($ index)"

<ion-slide-box active-slide="slidestop($index)">
</ion-slide-box>

, slidestop

$scope.slidestop = function(index) {
    $ionicSlideBoxDelegate.enableSlide(false);
}
+4

Probably your problem is that the slider needs to be visualized before you can turn off the slide. So in your controller use a timeout:

$timeout(function(){
    $ionicSlideBoxDelegate.enableSlide(0);
},0);
+2
source

In html add

<ion-slide-box active-slide="slidestop" does-continue="false">

And in your controller add

$timeout(function(){
$ionicSlideBoxDelegate.enableSlide(false);
},0);
+1
source

All Articles