How to use Stimulus JS 2.0's new Values and CSS Classes APIs Discussion
Discussion for
How to use Stimulus JS 2.0's new Values and CSS Classes APIs
i think the new default oninput would be better than the keyup (it used to be onchange by defailt on inputs and textareas)
Will the v.1.x html markup continue to work with v.2, or would I need to refactor them?
It is my understanding that the old data-target="controller-name.target-name"
and data-action="change->controller-name#action-name"
will continue to function but may be deprecated in the future. Am I correct?
When I upgrade stimulus.js version up to 2.0 and define static values object, the following error occurs:
Uncaught TypeError: _this.data.getAttributeNameForKey is not a function
at value_properties.js:13
at Array.reduce (<anonymous>)
at extended.get (value_properties.js:10)
at new ValueObserver (value_observer.js:7)
at new Context (context.js:9)
at Module../node_modules/@stimulus/core/dist/module.js.Module.fetchContextForScope (module.js:46)
at Module../node_modules/@stimulus/core/dist/module.js.Module.connectContextForScope (module.js:32)
at Router../node_modules/@stimulus/core/dist/router.js.Router.scopeConnected (router.js:92)
at ScopeObserver../node_modules/@stimulus/core/dist/scope_observer.js.ScopeObserver.elementMatchedValue (scope_observer.js:41)
at ValueListObserver../node_modules/@stimulus/mutation-observers/dist/value_list_observer.js.ValueListObserver.tokenMatched (value_list_observer.js:44)
Is there any solution for this?
ps: I have already installed stimulus(2.0.0) and stimulus_reflex(3.4.0)
export default class extends ApplicationController {
static values = {
departmentIds: Array,
profileIds: Array,
basicProfileId: Number,
};
...