Sign up ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.

I am trying to delete an object from an array with Angularjs Resource:

CommandeDetail.delete({id:commandeDetail.id});

My factory :

.factory('CommandeDetail', function ($resource) {
        return $resource('api/commandeDetail/:id', {}, {
            'query': { method: 'GET', isArray: true},
            'get': {
                method: 'GET'
            }
        });
    })

My object commandeDetail is (debug on Chrome before delete is called) :

commandeDetail: Resource
$$hashKey: "object:1136"
calibre: "douze"
categorie: "II"
certificatFournisseur: "AGROCERT"
commande: null
commandeId: 10
commentaire: null
dispJ4: 0
emballage: "COLIS 10 KG NET"
id: 35
marque: "ECOCERT"
max: 10
nbPalettes: 0
produit: "ABRICOT"
puht: 0
quantite: 10
tare: 0
valorisation: "Net"

The delete is well done on server side but I am getting this error on frontSide :

angular.js:11598 RangeError: Maximum call stack size exceeded
    at join (native)
    at Object.stringify (native)
    at toJson (http://localhost:8080/bower_components/angular/angular.js:1048:15)
    at defaults.defaults.transformRequest (http://localhost:8080/bower_components/angular/angular.js:8707:74)
    at http://localhost:8080/bower_components/angular/angular.js:8655:12
    at forEach (http://localhost:8080/bower_components/angular/angular.js:323:20)
    at transformData (http://localhost:8080/bower_components/angular/angular.js:8654:3)
    at $get.serverRequest (http://localhost:8080/bower_components/angular/angular.js:9319:23)
    at processQueue (http://localhost:8080/bower_components/angular/angular.js:13175:27)
    at http://localhost:8080/bower_components/angular/angular.js:13191:27

I don't know where that can come from. My object is quite simple.
If anybody can help me on this...
Thanks

share|improve this question
    
"Maximum call stack size exceeded" points towards endless loop using recursion. As this call happens due to Object.stringify (second "at" in callstack) angular tries to json-ify (convert a js object into json string) that contains end loop/circular dependency. – Capricorn Mar 25 at 10:23
    
I agree, but my object contains simple properties, that's why I don't understand. – user1260928 Mar 25 at 10:24
    
Try to debug into transformRequest function and investigate which object angular tries to stringify. – Capricorn Mar 25 at 10:30
    
Are you sure that you don't need absolute path in rest id: '/api/commandeDetail/:id' – Glen Swift Mar 25 at 11:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.