How to get the response text in restangular CustomPOST method

201 views Asked by At

I have an Angular app that uses Restangular library for API and I used customPOST method to include additional request data. How can I get the response text data of the response object (like the name key below)?

sample response is simple as this {"name":"5535bfbece3e14381ff3be9d.zip"}

1

There are 1 answers

0
sandip On

Provided you get the response in myObj, you can simply get the key as:

var myObj = {
 "name": "5535bfbece3e14381ff3be9d.zip"
};
var key = Object.keys(myObj);//this will get the "name" key

Refer this fiddle here