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
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.