angularjs - IonicPopUp using http.post result data -
how can pass data http.post results ionicpopup?
inside http.post success section create alertpopup function passing result parameter .
it opens popup there no data show.
i show data $scope.result .
here code use sample http://ionicframework.com/docs/api/service/$ionicpopup/ :
`$scope.showalert = function(result) { var alertpopup = $ionicpopup.alert({ title: 'detais', template: 'details : 1. {{result}} 2. {{state}} {{result.vehicle_brand}} 2. {{scope}}' }); alertpopup.then(function(res) { console.log('thank not eating delicious ice cream cone'); }); };`
this maybe issue of object's property access when received result
object.
try following code $http.post success callback function. try print out structure of result snippet:
$http.post(url).then(function(result){ console.log(json.stringify(result, null, 2)); });
i think structure maybe this:
{ "data": //your result should available here! { "vehicle_brand": { "a": "b" } }, "status": 200, "config": { "method": "post", ... } "statustext": "ok" } }
then can passing ionic popup function this:
$http.post(url).then(function(result){ console.log(json.stringify(result, null, 2)); $scope.showalert(result.data); //pass data property argument. });
Comments
Post a Comment