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?
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 );
}
}
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);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With