angularjs - Through rest service data is inserted successfully in DB but got $http status 0 : ionic -
i having issue in rest service in ionic. call ionic rest service. service called , data inserted in database..but in ionic after got status 0. how can solve this? in service response set status 201.. if call service through rest client got 201
but in ionic got 0
below controller
angular.module('starter.services', []) .factory('regservice', function($http,$q) { return{ insertregistration: function (reg) { var config = { headers : { 'content-type': 'application/json;' } } $http.post("http://xxx:8080/xxx/add/", reg) //success: callback called asynchronously when response available .then(function (response) { console.log("successful: response submitting data server was: " + response); alert("succ"); $q.defer().resolve({ data: response //returning response since `data` not defined }); }, //error: called asynchronously if error occurs or server returns response error status. function (response) { console.log("error: response submitting data server was: " + response); alert("error " + json.stringify(response)); //using promise reject func catch errors $q.defer().reject({ data: response //returning response since `data` not defined }); } ); return $q.defer().promise; } }})
it goes in error part...but checked in db data inserted.. how can solve problem? changes have success status??
Comments
Post a Comment