简体   繁体   English

为什么我尝试在其上调用deleteRecord时emberjs模型会引发异常

[英]why does my emberjs model throw an exception when i try calling deleteRecord on it

I am doing this tutorial and just when i thought i got everything right, I came across this exception 我正在做本教程,当我以为我做对了所有事情时,就遇到了这个异常

 JavaScript runtime error: Object doesn't support property or method 'deleteRecord'

in this context 在这种情况下

removeTodo: function () {
        var todo = this.get('model');
        todo.deleteRecord();
        todo.save();
    }

i trying to follow the getting started tutorial on the Ember.js site . 我试图遵循Ember.js网站上的入门教程。

It would appear that your model isn't actually a DS.Model (assuming that you're using Ember Data). 看来您的模型实际上不是DS.Model(假设您使用的是Ember Data)。 Unless you're model is an actual record I'm ember, you won't be able to call delete record. 除非您的模型是我要记录的实际记录,否则您将无法调用删除记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Emberjs:deleteRecord()不一致地更新模型 - Emberjs: deleteRecord() doesn't update model consistently EmberJS有模型数据,但是为什么我的模板不能正确显示模型值? - EmberJS has the model data, but why does my template not show the model values properly? 在过滤模型时,deleteRecord不会更新ArrayController - deleteRecord doesn't update ArrayController when Model is filtered EmberJS在deleteRecord和保存后抛出未定义 - EmberJS throws undefined after deleteRecord and save 为什么在Ember中成功完成deleteRecord后出现错误 - Why am I getting an error after successful deleteRecord in Ember EmberJS:当商店查询导致空集合时,从路径模型钩子中抛出404 - EmberJS: Throw 404 from route model hook when store query results in empty collection 为什么我不能无错误地更改此emberjs模型? - Why can't I change this emberjs model without an error? 模型更改时的emberjs事件 - emberjs event for when model changes 为什么我的非模型支持模板在重新加载时仍保持状态? - Why does my non-model backed template persist state when I reload it? emberjs:当我尝试使用操作助手时,我得到 - Handlebars 错误:无法在 object 上找到属性“操作” - emberjs: when I try to use the action helper, i get - Handlebars error: Could not find property 'action' on object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM