dimanche 26 mars 2017

Ember: Nothing Handled the Action Error Occured

So I'm following a tutorial to build an app on CodeSchool and I was trying to figure out how to write in a toggle when I noticed an error in the console basically saying that nothing is handling the action block I wrote in the template.

"Nothing handled the action 'toggleOption model option'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble."

The code below is the part of the template I'm having trouble with.

<ul class='list list--answer'>
            
              <li class='list-item'>
                <button class='list-item-checkbox ' >
                  <b class='srt'>Select</b>
                </button>
                <span></span>
              </li>
            
</ul>

This is the route associated with the template.

import Ember from 'ember';

export default Ember.Route.extend({
store: Ember.inject.service(),
model(){
    const poll = this.modelFor('polls.poll');
    return this.get('store').createVote(poll);
},
actions: {
    toggleOption(vote,option){
        vote.toggleOption(option);
    }
}
});

Anyways, is there something I'm missing? I've been staring at this for awhile and I couldn't figure this out. The tutorial video I've been following and their completed code doesn't seem to run into this issue either.




Aucun commentaire:

Enregistrer un commentaire