0

JSFiddle source
I use hello.bind('Hi!!!')
but inside method hello i get view-model Object instead of string value. Any ideas why?

1 Answer 1

1

Change your markup to:

<button data-bind="click: hello.bind($data, 'Hi!!!')">Say hello</button>

From the documentation:

Alternatively, if you prefer to avoid the function literal in your view, you can use the bind function, which attaches specific parameter values to a function reference. More on bind can be found at Mozilla.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.