How to use modal from StimulusSlimSelect #77
heraldofsolace
started this conversation in
General
Replies: 1 comment 1 reply
-
It's easier if you communicate between Stimulus controllers with events. For example, you should be able to add an action to listen for an "open" event and then fire an event to trigger it. <div data-controller="modal" data-action="open->modal#open"> const event = new Event("open")
modalElement.dispatchEvent(event) Something roughly like the above should work, but might need some tweaks as I haven't tested it. 👍 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using StimulusSlimSelect controller and I want to invoke the modal when the user adds a new option. I already have the default modal in the page. I tried giving my SlimSelectController to a shared parent of both the modal and the select and call
this.application.getControllerForElementAndIdentifier(self.modalTarget, "modal").open()
inside theaddable
function ofSlimSelect
but it doesn't work sinceopen
requires an event.Beta Was this translation helpful? Give feedback.
All reactions