Hi guys, I having a draggable gmap in an ion-slide, so I want to disable the swipe event for this SlideBox(only slide by slideTo method). But I can’t find any option about that, any ideal?
3 Likes
Answer my own question:
ion-slide-box
ion-slide.gmapSlide
// it's empty
ion-slide.otherSlide
// something in other slide
.gmapWarp(ng-if='slideIndex == 0')
It’s an easy hack and works fine with some css. But it’s not easy if I want .gmapWarp
have slide and drag effect like other slides. Wish it have some option for that .
Here is another way of doing this:
In your controller add a function:
$scope.disableSwipe = function() {
$ionicSlideBoxDelegate.enableSlide(false);
};
In your view add the ng-init attribute on the slide-box element
<ion-slide-box ng-init="disableSwipe()">
This will disable the slide-event.
You can now use a controller function to slide to a given index like this:
$scope.slideTo = function(index) {
$ionicSlideBoxDelegate.slide(index);
};
e.g. use it with ng-click on a button:
<button class="button" ng-click="slideTo(0)">First</button>
12 Likes
Thanks!!
Good point of view~
Thanks! This is what I need as well