when using the click bind in knockout, how does knockout know to pass the correct parameter to the method its bound to?
<div id="test" data-bind="click: runTest"/>
</div>
self.runTest = function (coolParameter){
doSomethingCool();
}
when using the click bind in knockout, how does knockout know to pass the correct parameter to the method its bound to?
<div id="test" data-bind="click: runTest"/>
</div>
self.runTest = function (coolParameter){
doSomethingCool();
}
from the documentation
There also is some discussion in the docs about how to pass more parameters by adding a wrapping function
knockout understands which value to pass from context. it's the current model object. e.g if you're in a foreach knockout passes the current item.