platanus/angular-restmod

$decode expected an object on model.$update

Opened this issue · 1 comments

Hi,

I'm currently working with this great library, but I don't know why some models got this problem, currently I got a model that is defined like this.

angular.module('app.models')
  .factory('Password', function(restmod) {
    return restmod.singleton('/users/password', {}, {});
  });

In the controller I use:

Password.$update({user: passwordData}).$then(function(response) {
        deferred.resolve(response.$response.data);
      }, deferred.reject);

But when the controller is executed I got an $decode expected an object error

utf4 commented

Your server is responding with the data which is either array or string or null but not json array. Did you looked into your developer's tool's network tab -> the response coming from the server?