我正在使用以下代码从服务器获取模型:
var id = args.model.get('id');
var options = {
action: 'getSubscriber',
address: args.model.get('address'),
silent: true
};
new Subscriber({ id: id }, options).fetch({
success: function(model, response) {
console.log(response);
console.log(model);
}
});
response
对象包含我需要的所有数据,而model
存储的数据不是作为其直接属性而是作为changed
对象。这是错的吗?通常,我在
model.get('name')
调用的帮助下访问模型属性。在这种情况下,如何访问新属性?应该是model.changed.thePropertyIwantToAccess
吗? 最佳答案
您可以使用此change
事件
this.model.on('change', function () {
var changedAttributes = this.model.changedAttributes();
//Process the changed attributes
}, this);
将此事件绑定到视图的
initialize
函数中关于javascript - 提取后如何访问更改的属性? bone.js,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23261438/