Knockout firing click binding on applyBindings

后端 未结 2 1084
长情又很酷
长情又很酷 2020-12-23 16:11

Recently I\'ve separated out ViewModel to a separate JavaScript file.

var Report = (function($) {
    var initialData = [];
    var viewModel = {
        rep         


        
2条回答
  •  佛祖请我去吃肉
    2020-12-23 16:46

    Another solution is to use 'bind' construct:

    data-bind="click: Report.preview.bind($data, 'url/to/report')" 
    

    where the first parameter to bind() will become the 'this' in the called function.

提交回复
热议问题