我在《示范公约》中有一些缺陷数据。
window.AppState = Backbone.Model.extend({
defaults: function() {
return {
country: false,
region: false
};
}
});
var appState = new AppState();
然后,在路线上,我拿着像这样的新价值观:
[["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?