Angular 1.3 $ promise error when making PUT $ resource request

I tried to update a project that is currently running Angular 1.2. * prior to 1.3.6, however I get an error whenever I ever try to make a PUT request to my REST server (start MEAN stack) using $ resource and $ http.

The dispatched data object has $ prom and $ resolve attached to the object in Angular 1.3, which failed in Mongo. Angular 1.2. $ prom etc. have been removed and are working. I have no idea how or what to change to get this to work? Any thoughts.

{"_id":"53ca230aeddbcb2c187254eb" "$promise":{},"$resolved":true}

      

The following Mongo error is specified

The dollar ($) prefix field "$ Promise" ... is not valid for storage

I understand why the error is being thrown. I just want to know how to remove $ prom like in Angular 1.2.

Here is my code block

   var projResource = $resource('/api/project/:projId', { projId: '@id' },
        { 'update': { method: 'PUT', params: { projId: '@id'}} });

   function saveProject(project, projId) {
        projResource.get({ projId: projId });
        return projResource.update({ projId: projId }, project);
    }

      

+3


source to share


2 answers


I was unable to identify the error described above. I recreate the project for scratch as a new angular 1.3 project and move everything and now it works correctly.



It was probably bad code.

0


source


My problem was that I was using angular -resource 1.2.x. After upgrading to 1.3.x, it stopped adding these properties to its JSON response



0


source







All Articles