$ionicActionSheet
The Action Sheet is a slide-up pane that lets the user choose from a set of options. Dangerous options are highlighted in red and made obvious.
There are easy ways to cancel out of the action sheet, such as tapping the backdrop or even hitting escape on the keyboard for desktop testing.
Usage
To trigger an Action Sheet in your code, use the $ionicActionSheet service in your angular controllers:
angular.module('mySuperApp', ['ionic'])
.controller(function($scope, $ionicActionSheet, $timeout) {
// Triggered on a button click, or some other target
$scope.show = function() {
// Show the action sheet
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;
}
});
// For example's sake, hide the sheet after two seconds
$timeout(function() {
hideSheet();
}, 2000);
};
});
Methods
show(options)
Load and return a new action sheet.
A new isolated scope will be created for the action sheet and the new element will be appended into the body.
Param | Type | Details |
---|---|---|
options |
object
|
The options for this ActionSheet. Properties:
|
- Returns:
function
hideSheet
A function which, when called, hides & cancels the action sheet.