I was trying a sample using breeze and knockout
manager.executeQuery(query).then(function(result){
console.log(result);
ko.applyBindings(result);
}).fail(function(e) {
console.log(e);
alert(e);
});
While printing in the console. I'm getting two objects in the path data.XHR.result.responseJSON and two objects in data.results
But in the view created as a result of knockout binding I'm getting the second set of value populated two times. (I have two set of values in the db)
NOTE: This code is working if I havent defined any metadata. Issue is in the scenario where I use metadata
metadata
var sample=sample||{};sample.metadata=
{
"dataServices":[
{
"serviceName":"/sample",
"hasServerMetadata":true,
"jsonResultsAdapter":"webApi_default",
"useJsonp":false
}
],
"structuralTypes":[
{
"shortName":"Employee",
"autoGeneratedKeyType":"None",
"defaultResourceName":"Employee",
"dataProperties":[
{
"name":"id",
"dataType":"MongoObjectId",
"isNullable":false,
"defaultValue":"",
"isPartOfKey":true,
"validators":[
{
"name":"required"
}
]
},
{
"name":"name",
"dataType":"String",
"maxLength":100,
"validators":[
{
"maxLength":100,
"name":"maxLength"
}
]
},
{
"name":"age",
"dataType":"String",
"maxLength":100,
"validators":[
{
"maxLength":100,
"name":"maxLength"
}
]
}
]
}
],
"resourceEntityTypeMap":{
"Employee":"Employee"
}
};
ko.applyBindings(result.results)I guess. - Rango