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
 |  Show 6 more ments

1 Answer 1

Reset to default 5

install whitelist plugin : cordova-plugin-whitelist

Since Cordova 5.0.0, Whitelist plugin is mandatory for cross origin requests

本文标签: javascriptCordovaWhy is http get request failing on android device but working on chromeStack Overflow