404 error for an existing url calling from cordova app [duplicate]

我是研究僧i 提交于 2019-12-12 03:58:29

问题


Here is my angular controller of a cordova app

angular.module('mobApp.controllers', ['ionic'])
.controller('SignupController', function($scope, $http, $location) {

        $scope.submitCommonSignUpForm = function(isValid, formData) {
            if (isValid) {
                var d = formData;
                $http.post('http://X.X.X.X/api/v1.0/basicSignup',formData).
                then(function(d){

                }).
                then(function(e){

                });
            }
        };  

});

I am getting 404 for http://X.X.X.X/api/v1.0/basicSignup but the fact is it exist. Any idea why ?

In my app Inside platform > android > res > config.xml i haveset <access origin="*" />


回答1:


You need to install the whitelist plugin from Cordova.

See my previous answer regarding this:

You need to install the whitelist plugin to allow XHR support in your Cordova app. You can't make external requests without it.

Run: cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git



来源:https://stackoverflow.com/questions/32032270/404-error-for-an-existing-url-calling-from-cordova-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!