Return data from http inside function

ぃ、小莉子 提交于 2019-12-01 21:15:55

The output you are getting is nothing but a promise object which has been returned by the $http.get method. Basically you need to put .then function over getdetails2 function for getting data from the promise object when it resolve/reject.

Code

getdetails2('12345').then(function(data){ //success callback
   //you will get data here in data parameter of function,
   var testing = data;
}, function(error){ //error callback
   console.log(error)
})
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!