# Dynamic generate Actionsheet with view content

**URL:** <https://forum.ionicframework.com/t/dynamic-generate-actionsheet-with-view-content/6234>\
**Category:** uncategorized\
**Created:** [June 30, 2014, 9:07am UTC](https://forum.ionicframework.com/t/dynamic-generate-actionsheet-with-view-content/6234 "2014-06-30T09:07:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ouss](https://avatars.discourse-cdn.com/v4/letter/o/50afbb/32.png) [@ouss](https://forum.ionicframework.com/u/ouss)\
**Post date:** [June 30, 2014, 9:07am UTC](https://forum.ionicframework.com/t/dynamic-generate-actionsheet-with-view-content/6234/1 "2014-06-30T09:07:32Z")

</div>

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;
     }
 });

```

![](https://sea1.discourse-cdn.com/ionicframework/uploads/default/1110/b9ea54637ef90fb7.PNG)

---

<div class="post-metadata">

**Author:** ![ouss](https://avatars.discourse-cdn.com/v4/letter/o/50afbb/32.png) [@ouss](https://forum.ionicframework.com/u/ouss)\
**Post date:** [June 30, 2014, 12:59pm UTC](https://forum.ionicframework.com/t/dynamic-generate-actionsheet-with-view-content/6234/2 "2014-06-30T12:59:27Z")

</div>

hi guys , any ideas please 😃

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [June 30, 2014, 3:58pm UTC](https://forum.ionicframework.com/t/dynamic-generate-actionsheet-with-view-content/6234/3 "2014-06-30T15:58:03Z")

</div>

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.

> **[ActionSheet: 1.0.0-beta.6](https://codepen.io/mhartington/pen/rBlKG)**
>
> Demo of an Ionic actionsheet Forked from \[Ionic\](http://codepen.io/ionic)'s Pen \[ActionSheet: 1.0.0-beta.6\](http://codepen.io/ionic/pen/jLylA/)....

---

<div class="post-metadata">

**Author:** ![stiyes](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@stiyes](https://forum.ionicframework.com/u/stiyes)\
**Post date:** [July 25, 2014, 6:32am UTC](https://forum.ionicframework.com/t/dynamic-generate-actionsheet-with-view-content/6234/4 "2014-07-25T06:32:12Z")

</div>

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})

---

<div class="post-metadata">

**Author:** ![fairupoyil](https://avatars.discourse-cdn.com/v4/letter/f/d6d6ee/32.png) [@fairupoyil](https://forum.ionicframework.com/u/fairupoyil)\
**Post date:** [April 19, 2015, 9:17am UTC](https://forum.ionicframework.com/t/dynamic-generate-actionsheet-with-view-content/6234/5 "2015-04-19T09:17:58Z")

</div>

thanks

it is working for me

---

<div class="post-metadata">

**Author:** ![saikiran123](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@saikiran123](https://forum.ionicframework.com/u/saikiran123)\
**Post date:** [May 22, 2015, 10:35am UTC](https://forum.ionicframework.com/t/dynamic-generate-actionsheet-with-view-content/6234/6 "2015-05-22T10:35:09Z")

</div>

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