listen for and emit custom events on dynamic modal #785
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was using a Single-File Component in a dynamic modal and found I needed trigger a method on the component that was invoking the modal, from within the component in the modal, but I don't want it tied to any of the existing modal events.
I've created a
custom-event
listener on the modal which accepts an object containing the name of the event I ultimately want to listen for and and object of params (optional).On the SFC shown in the modal, I emit the
custom-event
back to the parent:And I've invoked the modal as follows and the
my-custom-event
listener as follows: