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