1
を発生しません私がテンプレートに書いたアクションブロックを処理します。エンバー:アクションエラーを扱ったものは何もだから私はCodeSchool上のアプリケーションを構築するためのチュートリアルを以下だし、私は基本的に何もないことを言ってコンソールにエラーが気づいたとき、私はトグルで書く方法を把握しようとしていた
"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."
以下のコードは、私が問題を抱えているテンプレートの一部です。
<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>
これはテンプレートに関連付けられたルートです。
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);
}
}
});
とにかく、何かが欠けていますか?私はこれをしばらく見てきましたが、私はこれを理解できませんでした。私が従ってきたチュートリアルのビデオと完成したコードは、この問題に遭遇していないようです。
私は額に自分自身を叩いた。どうもありがとうございます。 –
これは間違っています! [これは閉鎖アクションではないので、アクションはルートにバブルする](https://ember-twiddle.com/99c21c302a7f5786e57f6e7988ef2e85?openFiles=templates.application.hbs%2C)。 – Lux
ありがとうございます@lux。私は自分の答えからその部分を削除した – kumkanillam