Hello everyone,
Need quick replies on this one. I have created an apk which is basically pointing to an online server but when I am making a $http post request, it is gives me a status code of 0 and null data.
This app build is working fine when I am pointing it to a local server. I have already used Whitelist plugin which was working fine previously with my old codebase.
Here is the $http method that I am using in my controller
$http({
method: 'POST',
url: HOST_NAME+'/user/signin',
data: LoginData
}).success(function(data, status, headers, config) {
$ionicLoading.hide();
if (data.error == false) {
localStorage.isAuthenticated = true;
localStorage.authToken = data.token;
$state.go('app.home.dash', {}, {
reload: true,
inherit: false
});
console.log(data.error);
} else {
$scope.formData.errors = {};
var errorMsg = data.msg;
$scope.formData.error = errorMsg;
}
}).error(function(data, status, headers, config) {
// console.log(JSON.stringify(data));
$ionicLoading.hide();
$scope.formData.errors = {};
if (status == 401 || status == 400) {
$scope.formData.error = "INVALID CREDENTIALS";
} else if (status === 0 || status === 404) {
$scope.formData.error = "CONNECTION ERROR " + status;
} else {
$scope.formData.error = "THERE WAS AN ERROR, STATUS CODE: " + status;
}
});
Please, help me on this.
Thank You