从cordova应用程式呼叫现有网址时发生404错误 [英] 404 error for an existing url calling from cordova app

查看:252
本文介绍了从cordova应用程式呼叫现有网址时发生404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的cordova应用程序的角度控制器

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){

                });
            }
        };  

});

我得到 404 $ c> http://XXXX/api/v1.0/basicSignup 但事实是它存在。任何想法为什么?

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

在我的应用程序内 platform> android> res> config.xml 我有 set< access origin =*/>

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

推荐答案

您需要安装来自Cordova的白名单插件

查看我的有关此的上一个答案:

See my previous answer regarding this:


您需要安装白名单插件,以允许XHR支持您的Cordova应用程序。

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

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

这篇关于从cordova应用程式呼叫现有网址时发生404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆