javascript - What is the best practice for nested models in Backbone? -


I have a collection " Map " and two models " Zone "And section ".

  zone attribute: zone_title: "new zone" width: 0 height: 0 order: 0 section: [] section attributes: section_ title: "new block" content: "some texts" order : 0   

How do I add these two models? There can be several sections in each zone .

Sections within each zone and area should be eligible for each section Could.

What is the best practice to do this?

I recommend that you take a look at - I think it's your use The case covers.

Since you asked about the best practice, which I can collect, the best practice when using backbone without any plugins is that the model should always be shallow. You will load a collection of area by bringing a map collection, but those areas will be shallow. For each region, you create a separate call to bring collection of sections for that area.

There is a difference in your use case, though. Are you loading all your zones in one go? Do you want to load all the sections of your areas simultaneously? Or are you getting streams for one or a few areas at a time?

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -