Is there a way to stop Knockout Mapping from applying a create callback for every nested properties within a model?
Here is an example of the data and mapping passed to ko.mapping.fromJS().
var data = {
name: 'Scott',
level1: {
name : 'Alice',
level2: {
name: 'Tom'
}
}
}
var mapping = {
name: {
create: function(options){
console.log(options);
}
}
}
Here is the jsFiddle: http://jsfiddle.net/2LQut/
I want the create function to be called only for the top level, only for "Scott" and not for "Alice" and "Tom".
The only workaround I have found to achieve this is to add this to the create function.
this.create = null;
Is there a better way to do this?