Need to set button side by side in ionic action sheet?


#1

I am developing Cordova mobile application using ionic framework.

I need something more in action sheet. I need 6 button in action sheet as you can see in image and all button should call separate function on ng-click.

so how can i achieve this?


#2

For something like this, you might want to consider creating a custom component. Action sheet follows the ios/material design guidelines.


#3

Thanks @mhartington For response

I had already arranged it. it is not possible to arrange six button in action sheet button, so i had arranged it in action sheet title by providing html string in title template including ng-click.

$scope.renderHtml = function(html) {
    return $sce.trustAsHtml(html);
  };

$scope.showActionSheet = function() {
      // Show the action sheet:
      $ionicActionSheet.show({
        buttons: [{
          text: 'More'
        }],
        titleText: $scope.renderHtml('<div class="row actionsheet-row"><div class="col text-center" ng-click="alert(123);"><span class="custom-actionsheet-icon ion-email"></span></div><div class="col text-center" ng-click="shareTwitter(card)"><span class="custom-actionsheet-icon ion-social-twitter"></span></div><div class="col text-center"><span class="custom-actionsheet-icon ion-social-facebook" ng-click="shareFacebook(card)"></span></div></div><div class="row actionsheet-row"><div class="col text-center" ng-click="shareText(card)"><span class="custom-actionsheet-icon ion-social-googleplus-outline"></span></div><div class="col text-center" ng-click="shareText(card)"><span class="custom-actionsheet-icon ion-social-linkedin"></span></div><div class="col text-center" ng-click="shareText(card)"><span class="custom-actionsheet-icon ion-social-pinterest"></span></div></div>'),
        cancelText: 'Cancel',
        cancel: function() {
          //alert("Clicked Cancel");
        },
        cssClass: 'customActionsheet',
        buttonClicked: function(index, buttonObj) {
             switch (index) {
               case 0:
                 //alert("Clicked Share");
                 return false;
               case 1:
                 //alert("Clicked More");
                 return false;
             }
            }
      });
     };

But ng-click is no triggering at all. have u any idea why it is not triggering


#4

Again for something like this, you probably want to make your own custom component, one that does not use the actionsheet code. The way you have it setup currently is going to be problematic. It’s fighting against what actionsheet was designed to do :smile:


#5

Thanks for reply, I will go for custom component :joy: