【发布时间】:2012-01-27 22:39:19
【问题描述】:
我是淘汰 js 的新手,得到了一个可观察的数组,在填充数组时,我订阅了我添加的每个实例的属性,当属性发生变化时(由于用户交互),我需要知道哪个对象发生了变化,但淘汰赛只给我相关属性的新值。 是否有可能获得对象? (我在函数上下文中尝试了“this”但没有成功)
length.isSelected.subscribe(function (isSelected) {
if (isSelected) { // no access to actual object only the isSelected value
debugger;
spotLenghts.push(this);
} else {
spotLenghts.pop(this);
}
});
【问题讨论】:
标签: knockout.js