0

通过 valueBinding 将值设置为 ember 单选按钮后,调用 Ember.run.end() 将更改的值反映在 DOM 中。

但请参阅以下错误。错误:未捕获的类型错误:无法调用 null wt 的方法 'prev' 是这里的问题

  //Doing value binding here
    App.radioController.set('content', App.createRadioModel.create({ id:1 }));
    Ember.run.end();
  //Doing some css changes as soon as the value is updated onto the radio button.
  Ember.$(".view-radio").removeClass("modified","delete");
4

1 回答 1

1

如果Ember.run.end()没有相应的Ember.run.start(). 您看到的错误可能是因为没有当前的运行循环。

如果您要手动同步绑定,可以使用Ember.run.sync(). 否则,我建议将您的代码包装在这样的Ember.run()调用中:

Ember.run(function() {
  // your code here
});
于 2012-06-02T23:30:03.787 回答