showDelete not working when in ion-nav-buttons


#1

My app has a state with a view containing an ion-nav-buttons, a subheader and a list in ion-content. It has 2 buttons in ion-nav-buttons, to overwrite the default buttons, one of them has ng-click=“data.showDelete=!data.showDelete”. This button does not show the delete buttons on the list. But when I move the showDelete button to subheader, the button works as expected. Could you help me please solve this issue?


Bug? ion-nav-button and ion-content seem to have separate $scope
#2

Ok, I solved this. I don’t know if I did it in the ionic way, but here is how:

Instead of
ng-click="data.showDelete=!data.showDelete"
put
ng-click="showDeleteButtons()"

and in the view controller

$scope.showDeleteButtons = function() {
  var status = $ionicListDelegate.showDelete();
  $ionicListDelegate.showDelete(!status);
}

#3

Thanks for posting your solution - had the exakt same problem. Somehow “properties” aren’t available in ion-nav-buttons, only functions. Strange.