Background
I have this structure from a restful api:
/channels/
/channel/{channelId}/
/channel/{channelId}/programs
In my backbone.js I have a collection Channels and two models, Channel and Program.
Problem
How can I easily fetch a nested model structure, and call a render function in my ProgramGuideView when all content is loaded?
What I have so far
So far I’m able to fetch the channels, but I don’t come up with any good way to fetch the programs for each channel.
Take a look into this:
http://documentcloud.github.com/backbone/#FAQ-nested
This is a very simple approach for having nested models and collections, but can be tuned to support any of your needs. If you need more sophisticated relational management then you should consider using a plugin like this:
https://github.com/PaulUithol/Backbone-relational