You still need to write out the name of the binding handler click
:
<button type="button" data-sbind="click: btnClick">button</button>
And you don't need this whole bindings
object with the sbtnClick
, just write:
var viewModel = function () {
this.btnClick = function () {
alert('clicked');
};
};
ko.bindingProvider.instance = new ko.secureBindingsProvider();
ko.applyBindings(new viewModel());
Demo JSFiddle.