Daniel Hsu
Daniel Hsu

Reputation: 21

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'>
            {{#each model.poll.option as |option|}}
              <li class='list-item'>
                <button class='list-item-checkbox {{if (eq model.option option) "is-selected"}}' {{action "toggleOption model option"}}>
                  <b class='srt'>Select</b>
                </button>
                <span>{{option.label}}</span>
              </li>
            {{/each}}
</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.

Upvotes: 2

Views: 373

Answers (1)

Ember Freak
Ember Freak

Reputation: 12872

There is syntax issue {{action "toggleOption model option"}} it should be {{action "toggleOption" model option}}.

Upvotes: 1

Related Questions