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
Asked
Active
Viewed 1,325 times
0
-
try the ionic stater tabs project https://github.com/driftyco/ionic-starter-tabs – Oct 02 '14 at 13:35
-
repeated: http://stackoverflow.com/questions/35426093/click-event-ng-click-not-working – Julio Marins Feb 20 '16 at 15:40
1 Answers
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