-1
我正在學習Knockoutjs並懷疑如何顯示observablearray()的值;knockoutjs observablearray not displayed
<script>
function Cliente(nome, CGC) {
this.Nome = nome;
this.Cgccfo = CGC;
};
function ordemservicoVM() {
self = this;
self.pessoas = ko.observableArray([
new Cliente("ValueOne", "ValueTwo")
]);
};
$(document).ready(function() {
ko.applyBindings(new ordemservicoVM());
}
</script>
HTML代碼::在
我的JS代碼
<table>
<thead>
<tr>
<th>Nome</th>
<th>CGC</th>
</tr>
</thead>
<tbody data-bind="foreach: pessoas" >
<tr>
<td data-bind="text: Nome"></td>
<td data-bind="text: Cgccfo"></td>
</tr>
</tbody>
</table>
已經使用了相同的結構,上面的代碼,它完美地工作。
是否有任何javascript錯誤? – 2013-03-05 16:29:17
你說它工作完美,它確實。你的問題是什麼? – Tyrsius 2013-03-05 16:30:45
@Tyrsius - 其他代碼完美工作,但沒有在上面的示例 – JulioCes 2013-03-05 16:38:47