Reputation: 11642
i implemented ionic SlideBox component:
http://ionicframework.com/docs/api/directive/ionSlideBox/
I would like to make slide (forward or backward) after click on button (not only after swipe gesture) is it possible and how can i do it please?
Many thanks for any example.
Upvotes: 3
Views: 5036
Reputation: 13997
Yes, if you read the page you included, you see a reference to $ionicSlideBoxDelegate
.
With that 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 codepen with a working example.
Upvotes: 3