admin管理员组文章数量:1405345
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
版权声明:本文标题:javascript - Cordova - Why is $http get request failing on android device but working on chrome - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744896980a2631122.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论