0

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

4

1 に答える 1

1

マークアップを次のように変更します。

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

ドキュメントから:

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. バインドの詳細については、Mozillaを参照してください。

于 2012-10-09T14:03:25.523 に答える