I have a Backbone view, for example, an Edit Profile view, where I’d hand the view my User model instance. However, I’d like, for example, to allow the user to select their favourite social network from a select dropdown. Now, this list of social networks is populated by them in another area of the application.
My question is, 1. what’s the best way to store these social networks? A model for each, so a collection of Social networks? and 2. do I then pass a collection (social networks) and a model (the User) to my Edit Profile view?
Is this the best way?
Basically you can use the initialize -function to do this kind of stuff. You can pass the other as the model or collection and the other just as some parameter, you just have to save a reference to it. Also you can give a view a model AND a collection.
Also, if you don’t want to assign it, you can just do
Hope this helps!