Skip to content

Instantly share code, notes, and snippets.

@nicwise
Created February 28, 2013 16:51
Show Gist options
  • Save nicwise/5058143 to your computer and use it in GitHub Desktop.
Save nicwise/5058143 to your computer and use it in GitHub Desktop.
TypeError: Object function g(a){v(a||{},this)} has no method 'update'
at g.Product.update (http://localhost:61011/js/product.js:9:32)
at Object.EditCtrl.$scope.save (http://localhost:61011/js/productedit.js:32:24)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:71:276
at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:142:402
at Object.e.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:87:347)
at Object.e.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:87:454)
at HTMLButtonElement.<anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:142:384)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:23:92
at Array.forEach (native)
at n (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js:6:192)
angular.module('product', ['ngResource']).
factory('Product', function($resource) {
var Product = $resource('/product/get/:id',
{
// update: { method: 'PUT' }
});
Product.prototype.update = function(cb) {
return Product.update({ id: this.Id.$oid }, <--- error fires here
angular.extend({}, this, { id: undefined }), cb);
};
Product.prototype.destroy = function(cb) {
return Product.remove({ id: this._id.$oid }, cb);
};
return Product;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment