开发者

How to "fetch" nested models and collections using backbone.js

I have a model which has 2 nested collections. What's 开发者_如何转开发the best way of automatically fetching those collections when I "fetch" the parent model?


In Rails you can include the dependant objects in your JSON. I do not know the backend you are using, but this would save you a couple round trips:

{
  att1: val,
  col1: [{obj1: val}, {...}],
  col2: [{...}]
}

Otherwise, override the initialize of Model to create and fetch the 2 new dependent collections.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜