Skip to content

Instantly share code, notes, and snippets.

@whisher
Created October 30, 2014 12:23
Show Gist options
  • Select an option

  • Save whisher/bc32443233db37c55866 to your computer and use it in GitHub Desktop.

Select an option

Save whisher/bc32443233db37c55866 to your computer and use it in GitHub Desktop.
app.controller('ItemsUpdateController', function ($scope, item, Items, $state) {
$scope.item = item;
$scope.item.$loaded().then(function(data) {
$scope.item = data;
});
$scope.add = function() {
var item = {};
item.$id = $scope.item.$id;
item.title = $scope.item.title;
item.ingredients = $scope.item.ingredients;
item.price = $scope.item.price;
item.url = $scope.item.url;
console.log(item.$id);// this is -J_C-1R8sb13Nqb-7jO6 but I've got Error: Firebase.set failed: First argument contains an invalid key ($id). Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"
console.log(Items.update(item.$id,item));/*.then(function () {
$state.transitionTo('items');
});*/ $state.transitionTo('items');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment