要素を含む設定のページがあります。各要素には、ViewModelプロパティへのバインドがあります。
設定の編集と保存を実装しようとしています。
function saveSettings() {
var new_settings = {};
new_settings.property1 = settingsViewModel.settings.property1();
new_settings.property2 = settingsViewModel.settings.property2();
new_settings.property3 = settingsViewModel.settings.property3();
.........
}
の内容が変更されていない場合は、正常に機能します。しかし、ユーザーがコンテンツを変更した入力に対して、「オブジェクトのプロパティxxxは関数ではありません」というエラーが表示されます。要素で何かが変更された後、Viewmodelとバインディングが壊れているようです。
私のバインディングは次のとおりです。
<input data-bind="value: settings.property1, valueUpdate: 'afterkeydown'" />
'keyup'、'keypress'、'input'も試しました-何も機能しません。
何か案は?