I am having trouble writing a service to update $ionicUser custom data. When the user logs in I can use the function to save a ‘favorite’ and then call $ionicUser.save() with no problem. When I go to update using $ionicUser.set(‘favorites’, data) and the try $ionicUser.save(); it throws an error: PATCH https://api.ionic.io/auth/users/dde6c678-b099-4ad1-8f4a-f422ba5660b9 400 (BAD REQUEST) I can use a .get to request the data no problem. But I cannot for the life of me update it.
addFavorite: function(item) {
$ionicUser.load().then(function() {
// success!
for(var i = 0; i < favoritesService.favorites.length; i++) {
if(favoritesService.favorites[i] === item) {
return;
}
}
favoritesService.favorites.push(item);
$ionicUser.set(‘favorites’, favoritesService.favorites);
$ionicUser.save();
});