Passing parameters to ActionSheet. How to do it?

Hi there,

I’m trying to use ActionSheet to delete task on my app. ActionSheet slides in fine and all that, but I can’t figure out how to make the ‘Delete’ button actually work.

$scope.showActionsheet = function (task) {

        titleText: 'What you wanna do with this task?',
        buttons: [
                text: 'Edit <i class="icon ion-ios7-compose-outline" i>'
        destructiveText: 'Delete',
        cancelText: 'Cancel',
        cancel: function () {
        buttonClicked: function (index) {
            console.log('BUTTON CLICKED', index);
            if (index = 0) {
                alert("Edit button");
            return true;
        destructiveButtonClicked: function (task) {
            // Is it here where I should do it?
            return true;

I’m not sure how should I provide the ‘task’ parameter to the action sheet in order to delete it.
I’ve got this function for deleting:

$scope.deletingTask = function (task) {
    database.deleteTask( () {
    }, function (err) {
    $scope.tasks.splice($scope.tasks.indexOf(task), 1);

Thanks for your help :slight_smile:

Alright, I fixed it myself.

I just didn’t need to give this function a ‘task’ object and it was crashing there.
so it should be:

destructiveButtonClicked: function () {
// delete task here

anyway, you need to provide the object when calling the showActionSheet() function.

Hi, i got the same problem. can i knw what you put in ur html file? izzit juz

Sorry for that,m I’ve been working on other platforms and didn’t really pay attention to this forum…
here my html

the Action Sheet:

<script id="popover.html" type="text/ng-template">
          <div class="list">
            <a class="item" href="#">
              {{ "HISTORY" | translate }}
            <a class="item" href="#">
              {{ "SEARCH" | translate }}
            <a class="item" href="#">
              {{ "LOGOUT" | translate }}

and the trigger was


I guess it’s kinda late, but I post it here in case someone gets to the thread with the same issue.