Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable swipe in ionic slidebox

In ionic we have slideBox.I want to disable swipe .I want it to slide on button click.How can i do it?

I have tried $ionicSlideBoxDelegate.enableSlide(false) in my controller but it is not working.

According to this link http://forum.ionicframework.com/t/ionicslideboxdelegate-disable-all-swiping/6391 i have to disable in the scope of the slidebox but how to access the scope of the element and apply it?

like image 347
Ankita Avatar asked Dec 02 '22 15:12

Ankita


2 Answers

The proper place to do it is in ng-init

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

and have the respective function in your controller

.controller('sliders', function($scope, $ionicSlideBoxDelegate) {
    $scope.lockSlide = function () {
        $ionicSlideBoxDelegate.enableSlide( false );
    }
}
like image 139
Gunar Gessner Avatar answered Dec 11 '22 02:12

Gunar Gessner


In your html file put active-slide="slidestop($index)"

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

And in Controller class that function "slidestop"

$scope.slidestop = function(index) {
    $ionicSlideBoxDelegate.enableSlide(false);
}
like image 26
kash Avatar answered Dec 11 '22 02:12

kash