i tried to get dynamic data from a external url using get method in http, it works fine in browser but when i run it from device the get request is not processed and returns status 0. CORS is also enabled. the controller is added below for reference
$scope.getData = function() {
$http.get("http://somedomain")
.success(function(data) {
$scope.firstname = data;
})
.error(function(data, status,headers,config) {
$scope.data = data;
$scope.status = status;
$scope.headers = headers;
$scope.config = config;
});
};
In my case it was not related to CORS, but after upgrade to Cordova 5 I needed to add the cordova plugin whitelist in order to keep backend requests working properly:
ionic plugin add cordova-plugin-whitelist
http://forum.ionicframework.com/t/update-to-cordova-5-0-0-make-http-call-error/22703