Dynamic generate Actionsheet with view content

Hi,
We want to be able to dynamically generate the Actionview with dynamic content. However, we face a problem where we can’t force actionsheet buttons,thanks

 $ionicActionSheet.show({
     titleText: 'Possible Action',
     buttons: [{
         text: 'Acknowledge selected alarm(s)'
     }, {
         text: 'Acknowledge all current alarm(s)'
     }, {
         text: 'Mask selected alarm(s)'
     }, {
         text: 'Mask all current alarm(s)'
     }],
     cancelText: 'Cancel',
     cancel: function () {
         console.log('CANCELLED');
     },
     buttonClicked: function (index) {
         console.log('BUTTON CLICKED', index);
         return true;
     }
 });

hi guys , any ideas please :smiley:

Hey there! So what you can do is have the buttons declared in your controller or from a service and then use that in your action sheet setup.

You can do like this

var buttonsGroup = ;
for (var i = 0; i < buttons.length; i++) {
var text = {“text”:buttons[i].optionText,“id”:buttons[i].optionId};
buttonsGroup.push(text);
}
$ionicActionSheet.show({
buttons: buttonsGroup})

thanks

it is working for me

Can we add html code or view inside ionic actionsheet.To be clear,I need an google map search input field in action sheet.Seems to be stupid ,but is there any chance…

1 Like