Trying To Map Array From Json To Knockout Using Mappings
Hi I have a JSON array like so [{ 'id': '537901a53513fa3374bec718', 'images': [], 'itemImage': 'img/3.jpg', 'createdDate': '5/18/2014 6:53:25 PM', 'location':
All you need to do is the following:
var viewModel = ko.mapping.fromJS(data);
ko.applyBindings(viewModel);
You loop them as follows:
<tableclass="table table-striped"><tbodydata-bind="foreach: $data"><tr><tddata-bind="text: id"></td></tr></tbody></table>
See example here:
Post a Comment for "Trying To Map Array From Json To Knockout Using Mappings"