【发布时间】:2015-08-10 21:10:50
【问题描述】:
我正在尝试在 EmberJS 中使用不同的库 bootstrap-switch。
我用.on('didInsertElement')添加了以下内容:
$(toggleTag).on('switchChange.bootstrapSwitch', function(event, state) {
this.sendAction('updateAction', state);
});
但是,当调用此事件时,this 的上下文将为 html 元素 toggleTag 返回 object。相反,我需要为this 访问component。
处理此问题的推荐方法是什么?
【问题讨论】:
标签: javascript ember.js bootstrap-switch