vendredi 23 juin 2017

How to display collapse when checkbox clicked in Ember bootstrap?

I'm fairly new to Ember and I'm trying to implement a Collapse method when I have clicked on a checkbox as a part of my form. This checkbox is inside a collapsed section part of a button group I have in my form.

Template.hbs

      
        
          
        
        <div>
          
            
            
          
        </div>
      

Component.js

collapsed: true,
actions: {
toggle() {
  let toggleValue = !get(this, 'collapsed');
  set(this, 'collapsed', toggleValue);
  }
}

When running ember serve and I go to my form if I click on the checkbox an error pops up in Ember Inspector:

Assertion Failed: You cannot use the form element's default onChange action for form elements if not using a model or setting the value directly on a form element. You must add your own onChange action to the form element in this case! Error

If I change onClick to onChange then fields aren't displayed when I click the checkbox, but I still get the error. What would be the best way to go about trying to fix this problem?




Aucun commentaire:

Enregistrer un commentaire