SteveSanderson/knockout — Issue #258: Documentation clarification for click binding
Author: martinstein
Created: 2012-01-05 15:06:52+00:00
State: open

I was just trying to apply the

"click: myFunction.bind($data, 'param1', 'param2')"

binding technique mentioned in http://knockoutjs.com/documentation/click-binding.html. The same technique is also mentioned on http://knockoutjs.com/documentation/event-binding.html.

Anyway: that part in the documentation is quite confusing, because what happens apparently is this:
1. The very first parameter (in the case above `$data`) is bound to 'this'. *But*, this could be something else, e.g. `$root`
2. the other parameters (`param1` and `param2`) are bound to the next function parameters
3. then, `$data` and `event` are bound to the final parameters.

Take a look at this http://jsfiddle.net/NWgZ4/2/ to see more clearly what's happening.

I think the documentation should more clearly reflect the 3 binding parts above (I was trying to get a `$root` reference into the callback function and it was confusing).

Otherwise, thank you very much for everything so far. I've only begun working with Knockout a few days ago, and everything works really smoothly. The documentation is otherwise very clear and the tutorials are great!