【发布时间】:2012-08-12 07:53:47
【问题描述】:
我正在使用淘汰映射插件,以前我会这样设置订阅
self.selectedProduct.subscribe(function (name) {
}
but I'm unsure of how to do this in this format below. The message I get is
“缺少:属性 ID 之后”
var viewModel = {
products: ko.mapping.fromJS([]),
productOptions: ko.mapping.fromJS([]),
productOptions.subscribe = function (name) {
alert('somthing change');
},
loadInitialData: function () {
ko.mapping.fromJS(serverData, viewModel.productOptions);
}
}
【问题讨论】:
标签: knockout.js