I am trying to bind my data to view but i am unsuccessful in all my attempts .
There is a Array of data i'm storing in a variable and later using mapping plugin and i am making those as observable's to bind it to view .
Interesting thing here is i am getting no errors in console
and i checked with
<span data-bind="text: ko.toJSON(Item)"></span>
I can see my array but i can't see it binded to view .
Script code :
console.log(ko.mapping.fromJS(jsonData));
var viewModel = new MainModel();
viewModel.Item(ko.mapping.fromJS(jsonData));
ko.applyBindings(viewModel);
Fiddle link is Here .
This is my first trail on the mapping plugin .Please do suggest me a reference to build some complex things using mapping plugin .
Any better approach is advisable if .
I don't remember but it is same as question I ask two days back.
I think if you want similar once problem I have solved it and you can find it on your updated fiddle. I also updated knockout version to 3.2.0.
http://jsfiddle.net/C46pU/9/
I've modified your fiddle, adding the "mapping" defenition and some other changes (i'm afraid of lost the sources, thus i posted them here).
The main thing is
where mapping plugin will be forced to use certain object creation function then deserializes your cild model.
Markup:
Code:
Hope, it helps.