1

采取以下措施:

FooController = Ember.ObjectController.extend
  # Model is set, view is rendered, button is clicked
  someDeleteAction: ->
    # Object is destroyed & removed from view
    @get('content').deleteRecord();

    # Uh-oh... error happens here, but object
    # remains 'deleted' according to ember 
    @get('content.transaction').commit();

有没有办法防止对象被破坏并从视图中删除?

加分点:在 1 到中国水酷刑的范围内......有多有趣ember-data

4

1 回答 1

0

我的解决方案:

覆盖DS.Model.deleteRecord,使其首先联系服务器,然后commit是事务。

于 2013-06-13T12:36:27.727 回答