In a recent tweet by Kasper, he showed an example I hadn’t considered before in using data-action="turbo:load->search#closeResults"
.
Reacting to turbo events in data-actions is a very flexible approach.
I tried a firing an action on turbo:load using data-action, but the action did not fire. In order to get it to work, I had to add @window
.
- data-action="turbo:load->my-controller#doSomething"
+ data-action="turbo:load@window->my-controller#doSomething"
Any ideas as to why I can’t get it to work similar to the example from Kasper?