2
来调用视图模型isValid()的函数我已经定义了一个视图模型如下:如何利用基因敲除验证
var ViewModel = function() {
var self = this;
self.property1 = ko.observable().extend({ required: true });
self.property2 = ko.computed(function() {
return self.property1();
});
self.form_onsubmit = function (form) {
if (!self.isValid()) {
console.log("error");
}
return false;
};
};
$(function() {
ko.applyBindingsWithValidation(new ViewModel());
});
当我打电话form_onsubmit
功能,出现错误:
TypeError: self.isValid is not a function
if (!self.isValid()) {
如何要解决它,谢谢^^^
谢谢!我知道了 – czclk 2013-09-12 16:02:44