In backbone.js, I’m noticing that the change and all events on a Model do not fire if you set the Model’s attributes to its existing attributes.
For example, if I set up the following events:
ActiveUser.bind('change', this.displayActiveUser, this);
ActiveUser.bind('all', this.displayActiveUserAll, this);
And then I manually set the value of ActiveUser to the empty string:
ActiveUser.set({ text : '' });
The events fire if and only if ActiveUser.text is not already set to the empty string.
This is reasonable behaviour. However, is there an event I can use that will fire even if the value being set is the existing value?
Update: I don’t see anything in the official Backbone.js list of events. Hmm.
You can always trigger the change event manually with
ActiveUser.trigger('change');.