utils method "toJson" won't recursively check values
klifa90 opened this issue · comments
Specifically this part
angular.forEach(dat, function(v,k) {
if (k.match(/[.$\[\]#\/]/) && k !== '.value' && k !== '.priority' ) {
throw new Error('Invalid key ' + k + ' (cannot contain .$[]#)');
}
else if( angular.isUndefined(v) ) {
throw new Error('Key '+k+' was undefined. Cannot pass undefined in JSON. Use null instead.');
}
});
If you have nested objects like:
{ name : "jhon",
phone : "12345",
address:
{
street : "1st st",
number : undefined
}
}
It will never detect that "number" is undefined and will not throw error, firebase sync will fail then every time.
I know that if it is receiving undefined then it must be a code bug (which i don't share), but anyways, if you are already checking, why are you not checking recursively?
Hi @klifa90! We have a required issue template. I'm going to close this issue, but free to open a new one that follows the template. Also if you could provide a plnkr that demonstrates the problem that would help out tremendously!