Hello,
I’d like to build a global modal for issue reporting.
In several pages of my app, I have a “Report Issue” button that should open a modal containing a form.
When calling the modal, I’d also like to pass sometimes additional data to it:
IE:
- I’m on the “itemA” view, I click the “Report Issue” button, I’d like to attach “itemA.id” to the issue.
- I’m on the main page, I click the “Report Issue”, it only sends the issue description.
I’d like to avoid code duplication as much as possible (not defining the modal behavior in every controller…)
I’d like not to store these additional issue data into a global var.
I’d like to display another “success modal” when the form submission is successful.
Ideally, the only code in each controller should be ‘$issueModal.show(issue_data)’
I tried this implementation but I’m not sure how to handle “$destroy” events.
Also, since I create a new modal everytime I call “.show”, I’d like to destroy the modal whenever it’s closed or “hidden”.
I’d be thankful to anyone giving me directions!