This is my code to update a record in firebase.
$scope.EditBrand = function(brand) {
var key = brand.id;
var fredNameRef = firebase.database().ref('all-brands/' + key);
fredNameRef.set(brand, function(error) {
if (error) {
alert ('some error')
} else {
alert ('updated')
}
});
}
I checked the key, and its coming correct.
But when calling this function this is the error.
angular.js:12477Error: Firebase.update failed: First argument contains an invalid key ($$hashKey) in path /$$hashKey. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]" at Error (native)
What is wrong with my code or logic??
$$hashKeyyour brand id ? If it is, FIrebase does not accept '$' in keys.var brandObject = angular.fromJson(angular.toJson(brand));and usebrandObjectin the rest of the method.