无法在durandal
中绑定点击功能视图模型:
define(function (require) {
var system = require('durandal/system');
var app = require('durandal/app');
var router = require('durandal/plugins/router');
return {
activate: function () {
},
addIdea: function () {
debugger;
}
};
});
视图上的按钮:
<input type="button" data-bind='click:addIdea' value="Add" />
欢迎任何建议!
答案 0 :(得分:0)
它对我有用:
define(['repositories/vmRepository', 'durandal/app', 'durandal/plugins/router'], function (vmRepository, app, router) {
idea:ko.validatedObservable({
...
}),
activate: function () {
},
addIdea: function () {
}
}
return vm;
查看:
<div data-bind="with: idea">
...
<input type="button" data-bind='click: $parent.addIdea' value="Add" />
</div>