I got that issue on my cordova project, created with angular and ionic. I've tried everything I could, and it ain't working.
Here's the code :
function getSuccess(response) {
$scope.modules = response.modules;
$scope.list = $scope.modules;
$scope.search = [
{str: ""}
];
}
$http({method: 'GET',
url: "/api/modules"
})
.success(getSuccess)
.error(function (response){
alert("Damned");
});
Of course, the IP is valid, and works in the chrome browser ;)
That's in my controller. I already added <access origin="*"/>
in my config file and it's still displays the "Damned" on my android device, after building.
Cordova version : 5.0.0 Android version : 5.1
I got that issue on my cordova project, created with angular and ionic. I've tried everything I could, and it ain't working.
Here's the code :
function getSuccess(response) {
$scope.modules = response.modules;
$scope.list = $scope.modules;
$scope.search = [
{str: ""}
];
}
$http({method: 'GET',
url: "http://xxx.xxx.xxx.xxx/api/modules"
})
.success(getSuccess)
.error(function (response){
alert("Damned");
});
Of course, the IP is valid, and works in the chrome browser ;)
That's in my controller. I already added <access origin="*"/>
in my config file and it's still displays the "Damned" on my android device, after building.
Cordova version : 5.0.0 Android version : 5.1
Share Improve this question edited Oct 14, 2017 at 7:48 Ahmad Baktash Hayeri 5,9004 gold badges32 silver badges43 bronze badges asked May 25, 2015 at 20:33 Guillaume MunschGuillaume Munsch 1,2831 gold badge18 silver badges40 bronze badges 11-
response
should contain details about the error. don't output a fixed(useless) error message when you can be told exactly what's wrong. – Marc B Commented May 25, 2015 at 20:34 - I actually wanted to use something like console.log, but i don't know how to do that in the application, any idea ? :/ – Guillaume Munsch Commented May 25, 2015 at 20:37
-
even something like
alert(JSON.stringify(response))
could help. anything to get the contents of the error object out and viewable. – Marc B Commented May 25, 2015 at 20:39 - 3 install whitelist plugin cordova-plugin-whitelist (and I don't mess up with the ZOHANNNN) – aorfevre Commented May 25, 2015 at 20:56
- 1 @aorfevre post your ment as an answer, i'll put +1000 at it. You just save my life ! Tyvm ! <3 – Guillaume Munsch Commented Jun 2, 2015 at 16:48
1 Answer
Reset to default 5install whitelist plugin : cordova-plugin-whitelist
Since Cordova 5.0.0, Whitelist plugin is mandatory for cross origin requests
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744896980a4599754.html
评论列表(0条)