data-bind="Contacts,
据我所知,您的数据绑定无效。
做你想做的事,你就在正确的轨道上。这是一个示例模型:
function HolderObject(enterPriseArray){
var self = this;
self.enterprise = ko.observableArray([]);
_.each(enterPriseArray, function(e){
self.enterprise.push(new SomeObject(e));
});
ko.applybindings(self) // probably bind it to a div tag somewhere
}
function SomeObject(data){
var self = this;
self.nameEnterprise = ko.observable();
self.prioPhone = ko.observable();
self.NumberEnterprise = ko.observable();
self.EnterPrise = ko.observable(new Enterprise(data.fullName));
}
function Enterprise(fullName){
var self = this;
self.fullName = ko.observable(fullName);
}
然后将您的表格更新为类似
<tbody id="list" data-bind="foreach: enterprise">
<tr class="line">
<td data-bind="text: nameEnterprise "></td>
<td data-bind="text: prioPhone "></td>
<td><span data-bind="text:FullName"></span><span data-bind="value: $parent.NumberEnterprise"></span></td>
</tr>
</tbody>