In the app I am currently working on I am opening a Modal. Inside the Modal there is a button to open an Action Sheet. The Action Sheet opens properly however, after about one second the Modal closes. The Action Sheet remains and does what it is supposed to do. Is there a way to prevent the Modal from being closed when the Action Sheet is opened?
Okay, narrowed this down some. Inside the Modal there is a form with ng-submit that calls a function to save the user’s input on form elements inside the modal. once the save is complete it calls the function to close the modal. For some reason the save function is being triggered when the Action Sheet opens.
Answered for myself… sharing in hopes it helps someone else down the road…
I figured this out. Basically what was happening was that I had a button that when clicked would open the Action Sheet. This button used … the button tag. Apparently the type attribute defaults to “submit”. So, when I would tap the button to open the Action Sheet it would also trigger the submit event on the form thus closing the Modal. I’m not sure if it is Angular or Ionic that causes buttons with no type attribute to default to “submit”… either my solution was to explicitly define the type as button… button type=“button” I also tried simply changing the offending button tag to a div styled with button classes which worked fine but, opted to type the button instead as it seems semantically correct.