angular-restful-resource
Advanced tools
Comparing version 0.0.1 to 0.0.2
'use strict'; | ||
angular.module('ngRestfulResource', ['ngResource']).factory('$restfulResource', ['$resource', function ($resource) { | ||
return function (url, params, methods) { | ||
return function (url, params, methods, options) { | ||
methods = angular.extend({ | ||
@@ -10,9 +10,13 @@ update: { method: 'PUT' }, | ||
options = angular.extend({ | ||
idAttribute: 'id' | ||
}, options); | ||
var resource = $resource(url, params, methods); | ||
resource.prototype.$save = function () { | ||
if (!this.id) { | ||
if (this[options.idAttribute]) { | ||
this.$update.apply(this, arguments); | ||
} else { | ||
this.$create.apply(this, arguments); | ||
} else { | ||
this.$update.apply(this, arguments); | ||
} | ||
@@ -19,0 +23,0 @@ }; |
@@ -0,0 +0,0 @@ The MIT License |
@@ -11,3 +11,3 @@ { | ||
"main": "angular-restful-resource.js", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"license": "MIT", | ||
@@ -14,0 +14,0 @@ "repository": { |
@@ -0,0 +0,0 @@ angular-restful-resource |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2503
21