【发布时间】:2014-01-28 11:43:46
【问题描述】:
JS:
function Child() {
this.method = function() {
console.dir(this); // this should be 'p.child' <Child> since
//'method' called as a property of 'p.child'
// but when you call it from KO it's actually 'p' <Parent>
};
}
function Parent() {
this.child = new Child();
}
var p = new Parent();
ko.applyBindings(p);
HTML:
<a href="#" data-bind="click: child.method">foo</a>
是错误还是我不明白的功能?
【问题讨论】:
标签: javascript html knockout.js