Closed cashmann closed 1 year ago
I'm having an issue where my Stimulus controller is not picking up event params for a click action. I'm referencing https://stimulus.hotwired.dev/reference/actions#action-parameters to wire this up. Here's a simple setup I have:
View code:
<%= search_form_for @q, url: "#", html: { data: { controller: "balance form" } } do |f| %> ... <tr data-action="click->balance#updateTargetRow" data-balance-id-param="2"> ...
Stimulus controller code:
// app/javascript/controllers/balance_controller.js import { Controller } from "@hotwired/stimulus" export default class extends Controller { updateTargetRow(event) { console.log(event.params) //always logs `{}` ... } }
Accessing the param via event.currentTarget.dataset.balanceIdParam gives the expected value of "2" in this example. Is this a known issue or do I have something setup wrong?
event.currentTarget.dataset.balanceIdParam
Nevermind, I'm an idiot.
I'm having an issue where my Stimulus controller is not picking up event params for a click action. I'm referencing https://stimulus.hotwired.dev/reference/actions#action-parameters to wire this up. Here's a simple setup I have:
View code:
Stimulus controller code:
Accessing the param via
event.currentTarget.dataset.balanceIdParam
gives the expected value of "2" in this example. Is this a known issue or do I have something setup wrong?