SteveSanderson / knockout-es5

Knockout.js meets ECMAScript 5 properties
157 stars 39 forks source link

ko.track is undefined in click handlers #13

Closed brigand closed 9 years ago

brigand commented 10 years ago
<button data-bind="click: handle"></button>
this.handle = function(){
    ko.track({foo: "bar"}) // Error
};

The source of the error is this line which does var ko = this, however knockout click bindings change the meaning of this.

SteveSanderson commented 9 years ago

Fixed (thanks)