I use AngularJS $resource to save large objects. Everything worked good, until object became really large.
angular.module('Test.services').factory('TestService', function($resource) {
return $resource( '/MyRestURL/:id', { id: "@id" }, {
save : {
method: 'POST',
isArray: false,
params: {
data: "@data"
}
}
});
});
I get response
Method POST
Cached No
Status Request-URI Too Large
Code 414
And I see it sends everything in URL...
Try using
angular.module('Test.services').factory('TestService', function($resource) {
return $resource( '/MyRestURL/:id', { id: "@id" }, {
save : {
method: 'POST'
}
});
The params
tell angular to put that property in the url as get parameter. (And the isArray
is false by default.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.