I am generating buttons dynamically based on the data. I have to assign the data-name attribute dynamically as well. The dynamic buttons generation is working properly.
but if i want to add a click (knockout js) event to these buttons, it returns an error at the run time that the knockout function is undefined.
<button data-bind="attr: { 'data-name': $data.code }" class="btn btn-primary"></button>
here is my view
define(['services/logger', 'durandal/system'],
function (logger, system, staffheader) {
var title = 'Staff Review';
var StaffReviewRequestObject = ko.observable();
var vm = {
activate: activate,
StaffReview: ko.observable(),
ReviewCode : ko.observableArray(),
loadViewModel: ko.observable(),
buttonLoadModel: buttonLoadModel
};
return vm;
function activate() {
return true;
}
});
any suggestions, why the runtime cannot find the click event "buttonLoadModel" ???