Prevent slide change in ion-slides

How can I prevent ion-slides from changing slides? I’m rendering ion-slide-page in a ng-repeat and I have two custom buttons for next/prev. When I click next for example, I wanna do some stuff and post to server and if successful move to the next slide, otherwise prevent slide change and stay on current index.

I’ve googled around and tinkered with the API for hours but couldn’t find a solution. Thanks in advance.

When the user reaches to a particular slide with some condition is not satisfied use the event handler function in your controller as

$scope.slideHasChanged = function(data)
{

if (data == 2) //Slide Number of your slide
{
            if (Condition)
            {
                      $ionicSlideBoxDelegate.slide(1); //Slide number where to Stay if condition
            }
}

}

Thank you but this only slides back to an index, which is not desired.
I ended up changing my domain model and UI :slight_smile: slides are no longer constrained in any away and I’ve put my logic somewhere else.