Knockout mapping is not working a array of objects.
Here is my fiddle http://jsfiddle.net/varunfiddle/03rv2the/
Basically I have tried to map a array of objects into a observable array.
var ViewModel = function() {
var self = this;
var newData =
[{"PersonId":1,"Name":"LoginUser1","OriginalSource":null,"Remarks":null},
{"PersonId":2,"Name":"LoginUser1","OriginalSource":null,"Remarks":null}];
self.persons=ko.mapping.fromJS(newData, {}, self);
};
var myVM = new ViewModel();
ko.applyBindings(myVM);
And later bind it in the html
<table>
<tbody data-bind="foreach:persons">
<tr>
<td>
<label data-bind="text:Name"></label>
</td>
</tr>
</tbody>
</table>
I do not see data binding taking place on the array of objects. Is there a fix ? Thanks.