问题描述
让我们说我们有 Post = DS.Model.extend({
comments:DS.hasMany {async:true})
})
注释= DS.Model.extend({
post:DS.belongsTo()
})
,我必须使用链接
功能,否则我得到由于对帖子的评论太多,导致414错误。
由于此提交
似乎无法触发重新加载post.get('comments'),即发送GET请求例如post / 42 / comments。
有没有解决方案? p>
感谢@igorT,这是实现的。
现在,ManyArray有一个reload()方法,如果关系尚未加载,您甚至可以调用。
您可以通过阅读
Lets say we have
Post = DS.Model.extend({
comments: DS.hasMany({async: true})
})
Comment = DS.Model.extend({
post: DS.belongsTo()
})
and I have to use the links
feature because otherwise I get a 414 error due to too much comments on a post.
Since this commit https://github.com/emberjs/data/commit/4d717bff53f8c93bedbe74e7965a4f439882e259
It seems like it's impossible to trigger a reload of the post.get('comments'), ie sending a GET request on for example post/42/comments.
Is there any solution for that ?
Thanks to @igorT, this is implemented. https://github.com/emberjs/data/pull/2297
Now the ManyArray has a reload() method, which you can even call if the relation has not been loaded yet.
You can see some use cases by reading the tests
这篇关于如何重新加载异步与链接有很多关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!