user2817508 user2817508 - 4 months ago 79
AngularJS Question

Ionic framework new Ionic Slides based on the Swiper widget from idangerous: how to change slide after button ng-click?

Reference Link: http://ionicframework.com/docs/api/directive/ionSlides/


I would like to make slide forward or backward after click on the previous or next button.

I have working example for swipe gesture Codepen.


how can I do it for button click?

$scope.slidePrevious = function() {

}

$scope.slideNext = function() {

}

Answer

Just put this into your click handlers, it'll do the job

$scope.slidePrevious = function() {
    $scope.data.sliderDelegate.slidePrev();
}

$scope.slideNext = function() {
    $scope.data.sliderDelegate.slideNext();
}

Here is updated codePen http://codepen.io/kmlzjc/pen/rLKdbR