Created
October 30, 2014 12:23
-
-
Save whisher/bc32443233db37c55866 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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