Question

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...

Was it helpful?

Solution

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.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top