Cannot interact with DOM while ons-action-sheet is active



  • If I use the example code from https://onsen.io/v2/api/js/ons-action-sheet.html.
    I can’t interact in the “then”-part:

    ons.openActionSheet({
        title: 'Source:',
        cancelable: true,
        buttons: [
          'Gallery',
          'Camera',
        ]
      }).then(function (index) { 
         switch(index) {
            case 0:
                 $('#input_img').trigger('click'); // Can't do this while action-sheet is active?
                break;
            case 1:
                 /*navigator.camera.getPicture(.......*/
                break;
        }
     })
    

    What should I do?


  • Onsen UI

    @Bassie What is the error? Can you print stuff in the then part?



  • No errors.
    I use:

     $('#input_img').trigger('click');
    

    …for when the cordova-camera-plugin fails loading (=PC).

    I now check for:

    if (navigator.camera){..
    

    …before opening the Action Sheet, that also works fine.


Log in to reply