Hi!
I am new at using in Stimulus, and I have tried to send a param into a function. I have been reading the guide:
https://stimulus.hotwired.dev/reference/actions#action-parameters
I have:
<div data-controller="subscribe">
<button data-action="click->subscribe#upvote"
data-item-id-param="1234567890">…</button>
</div>
and
// assets/controllers/subscribe-controller.js
import { Controller } from '@hotwired/stimulus';
/* stimulusFetch: 'lazy' */
export default class extends Controller {
upvote(event){
console.log(event);
}
}
It call the function but event.params is always:
params: {}
What am I doing wrong?
Thanks