For instance:
assume that BackBoneModel is a model that i’ve created and extended to Backbone.Model
var specificModel = new BackBoneModel;
var view = new BackBoneView({model: SpecificModel});
or:
var view = new BackBoneView({model: BackBoneModel});
I am having trouble understanding whether, when creating a view and attaching a model, it is required that I attach an model object I’ve instantiated or the actual model itself. Thanks for your help.
The short anwser is that you should be using a specific instance. When a view is tied to a specific model it contains a reference to that model and you can then reference that models attributes, and further bind to it’s attributes so that changes to them cause the view to rerender.
Not all view’s need to have a model specified but if you do want it then doing it this way is (that is when you create the view) is a shortcut to specifying it afterwards so instead of
You just use