knockoutjs – bindings with parameters triggered on load

I think “Note 2” on this knockout page explains it all:

http://knockoutjs.com/documentation/click-binding.html

You can avoid the problem by either using:

Anonymous functions:

<button data-bind="click: function(data, event) { myFunction(data, event, 'param1', 'param2') }">Click me</button>

… or …

The bind method:

<button data-bind="click: myFunction.bind($data, 'param1', 'param2')">Click me</button>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)