You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating an instance of a model, you can pass in the initial values of the attributes, which will be set on the model. If you define an initialize function, it will be invoked when the model is created.
What it doesn't say is what arguments that initialize function takes, which if I remember correctly includes the options object passed in on instantiation.
Where is this documented?
The text was updated successfully, but these errors were encountered:
initialize is called at the end of the constructor function, and is passed the same arguments that you've passed to the constructor. The default implementation is to do nothing.
Oh, good to know. This also clarifies a second question I had - whether attributes passed in in the constructor were available in the initialize function. It appears they are. As in, get I do this.get('some_attribute') inside the initialize function.
I'm looking up how to instantiate a Backbone.Model. Under the docs for constructor / initialize, it says:
What it doesn't say is what arguments that initialize function takes, which if I remember correctly includes the
options
object passed in on instantiation.Where is this documented?
The text was updated successfully, but these errors were encountered: