我正在尝试使用Restangular服务,但我遇到了一个无法解决的问题。例如,我正在执行POST请求,我希望获得干净的响应对象,但在包装了所有Restangular
方法的响应对象中,我知道这可能是一个功能,但我需要干净的响应:))
this.Restangular.one("auth").post("login",data).then(function(resp){
console.log(resp);
// in response object wrapped all Restangular methods
}
发布于 2014-07-22 19:14:19
您可以使用.plain()
从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)
}
您需要使用Restangular 1.4.0版本
https://stackoverflow.com/questions/24885101
复制相似问题