Knockout映射不会产生结果

时间:2013-07-07 04:18:45

标签: knockout.js viewmodel knockout-mapping-plugin

我错过了什么?请帮忙。 这是我的代码

var data= {
"CountyOfPractice":"Bronx",
"Territory":"TERR0102",
 "Specialty":"OralSurgery",
 "Fulltime":true,
"Occurence":false,
"Discounts":"waiver_of_consent,one_time_payment",
"Payment":null,
"Rate":{"Claims made year 1":7668,
"Claims made year 2":14667,
"Claims made year 3":19171,
"Claims made year 4":21181,
"Claims made year 5":22982,
"Mature Claims Made: ":24253}
};

//Create model
var viewModel = ko.mapping.fromJS(data);
//bind
ko.applyBindings(viewModel);

这是HTML

<input type="text" data-bind="value: CountyOfPractice" />

输入框为空,没有任何反应。 请建议

1 个答案:

答案 0 :(得分:0)

GOT IT。 使用了错误链接到knockout.mapping 这是好的 http://cdnjs.cloudflare.com/ajax/libs/knockout.mapping/2.3.5/knockout.mapping.js

现在它也适用于我!!!