0

My project has a navigation view with tabs at the bottom I want when a specific tab is clicked an action sheet pops up. I tried launching a function when the controller is instantiated but that only launches the action sheet once obviously

anthony
  • 1
  • 2

1 Answers1

2

I did a few things to make this work - not sure it is the best. First, I removed the href from a tab and the inner nav child:

I also added a ng-click action. My showActionSheet needs to defined in rootScope, not a controller, since it needs to be available no matter what controller is active. So in app.js, I added the sample code for it.

.run(function($ionicPlatform,$rootScope,$ionicActionSheet) {

$rootScope.showActionSheet = function() {
  console.log("showAS");
  var hideSheet = $ionicActionSheet.show({
    buttons: [
      { text: '<b>Share</b> This' },
      { text: 'Move' }
    ],
    destructiveText: 'Delete',
    titleText: 'Modify your album',
    cancelText: 'Cancel',
    cancel: function() {
    // add cancel code..
    },
    buttonClicked: function(index) {
      return true;
    }
});


};
Raymond Camden
  • 10,661
  • 3
  • 34
  • 68