-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binding functions with correct context, in templates #3
Comments
Good point - I've just commited a tweak that hopefully does just what you want. Please try the latest source code version from http://github.com/SteveSanderson/knockout/tree/master/build/output/ and see if it does. It will set 'this' to be whatever "data" value the template is using (i.e., $data if you're using the default template engine), so if you have nested templates, it will use the "data" value from the current level of nesting. This is much more useful than the previous behaviour of not setting any particular "this" value when invoking click/submit/etc binding functions. |
When binding a function to a click (in a template) the "this" of the function is not set to the view model.
Execute
Instead, I have to do this:
Execute
Can this be improved to match the former example?
The text was updated successfully, but these errors were encountered: