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"}
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.