[英]“Attempted to handle event `reloadRecord` on <App.User:ember820:me> while in state root.deleted.saved. ”
I tried searching for same kind off issue if asked already but couldn't find exactly. 如果已经问过,我尝试搜索同类问题,但找不到确切的问题。 My problem is:-
我的问题是:
I'm calling a function from a .handlebars class with the required parameters but while it is calling the function, at one point where it's calling reload() function, it throws exception. 我正在从.handlebars类中调用具有所需参数的函数,但是在调用该函数时,在调用reload()函数的某一时刻,它引发异常。
The code snippet is like:- 该代码段类似于:
saveBookmark: function saveBookmark(name, value, version) {
var self = this;
this.get('user').reload().then(function () {
var bookmarks = self.get('bookmarks') || [];
var newBookmarkId = bookmarks.sortBy('id').getWithDefault('lastObject.id', 0) + 1;
var date = moment().format('YYYY-MM-DD');
bookmarks.push({ key: self.get('key'), version: version, id: newBookmarkId, name: name, value: value, date: date });
self.set('bookmarks', bookmarks);
self.send('savePreferences');
});
},
So, the exact line where it;s throwing error is:- 因此,它的抛出错误的确切行是:
this.get('user').reload()
However, on browser console, I can find the value of 但是,在浏览器控制台上,我可以找到
this.get('user')
Firther, I can not make changes to this function as this is generic and is being used aross several places and working fine. 此外,我无法对此功能进行更改,因为它是通用的,已经在多个地方使用并且工作正常。
If you could provide me some idea of occurrence of this issue to resolve would be of much help. 如果您能为我提供一些解决此问题的想法,将大有帮助。
The exception I'm getting is:- 我得到的例外是:-
"Attempted to handle event `reloadRecord` on <App.User:ember820:me> while in state root.deleted.saved. "
PS:- I'm new to Ember.js. PS:-我是Ember.js的新手。
That error means your user
object (the one you refer to with this.get('user')
) is in an invalid state (did it get deleted somewhere else?). 该错误表示您的
user
对象(您使用this.get('user')
引用的对象)处于无效状态(是否已将其删除到其他位置?)。 And so the code you are writing is complaining that it can't reload a deleted model ... 因此,您正在编写的代码抱怨无法重新加载已删除的模型...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.