I have some defults data in Model
window.AppState = Backbone.Model.extend({
defaults: function() {
return {
country: false,
region: false
};
}
});
var appState = new AppState();
Then in Router I get array with new values for model like this:
[["country", "new country value"], ["region", "new region value"]]
And now in a for loop i cycle to update all received params... I realize it this way
appState.attributes[arg] = val;
but I think it's not clear, because in documentation of Backbone.js I read about "attribute" method and see this: "Please use set to update the attributes instead of modifying them directly." So my questions is: How i can change attributes of defaults using set method?