Stop checker for ion-item?

Hi there I’m new to Ionic.

I want to do something similar to below code, ie. confirm the user before switching to another view.

  <ion-item ng-repeat="task in tasks" type="item-text-wrap" href="#/tab/tasks/{{}}" ng-click="confirm('Are you sure?')">
     // Some codes...  

But I found although the confirm box pops out, but the view has already move to another page before the user give response.

Is there any way in Ionic to solve this problem?

First do not use href in ionic apps.
AngularJS provides ngHref and ui-Router the ui-sref directives.

To solve your problem:

  1. remove href
  2. if you are opening a popup the use has to confirm you can add buttons with custom actions$ionicPopup/
    if the user confirms through a button --> redirect programmatically with $state.go(“yourStateName”)$state
1 Like