19

I'm trying to use Restangular service, but I have gotten one problem which I can't solve. For example I'm doing the POST request and I want to get clean response Object, but in my response Object wrapped all Restangular methods, I know may be it's a feature, but I need my clean response :))

 this.Restangular.one("auth").post("login",data).then(function(resp){
                console.log(resp);
                // in response object wrapped all Restangular methods 

            }
Avag Sargsyan
  • 2,437
  • 3
  • 28
  • 41
Narek Mamikonyan
  • 4,601
  • 2
  • 24
  • 30

1 Answers1

31

You can get the plain element using .plain() from response

 this.Restangular.one("auth").post("login",data).then(function(resp){
      console.log(resp.plain());
      //Returns the plain element received from the server without 
      //any of the enhanced methods from Restangular. 
     //It's an alias to calling Restangular.stripRestangular(elem)
 }

You need to use Restangular version 1.4.0

Plunkr - http://plnkr.co/edit/qDAyPqywC27in9wnlAHF

hutingung
  • 1,800
  • 16
  • 25