Ionic structure ionSlideBox: how to change slide after ng-click button?
i the ionic component SlideBox is implemented:
http://ionicframework.com/docs/api/directive/ionSlideBox/
I would like to do a slide (forward or backward) after a button is pressed (not just after gestures), and how can I do that?
Thanks a lot for any example.
+3
source to share
1 answer
Yes, if you read the included page, you will see a link to $ionicSlideBoxDelegate
. With this delegate, you can do:
<button ng-click="slidePrevious()">Previous</button>
<button ng-click="slideNext()">Next</button>
controller:
.controller('MyCtrl', ['$scope', '$ionicSlideBoxDelegate', function($scope, $ionicSlideBoxDelegate) {
$scope.slidePrevious = function() {
$ionicSlideBoxDelegate.previous();
}
$scope.slideNext = function() {
$ionicSlideBoxDelegate.next();
}
});
Checkout this code using a working example.
+3
source to share