Reputation: 21553
After fetching a model, I want to set a certain property of the model that is based on the fetched attributes. How can I do this by using Backbone.Model.extend ?
Upvotes: 0
Views: 27
Reputation: 169
You could listen to the events on the model like this. The sync event is fired after the model has synced with your server so it should be after the fetched attributes.
var model = Backbone.Model.extend({
initialize: function(){
this.on("sync", function(eventName) {
/* your code */
});
}
});
Upvotes: 2