使用Ionic和AngularJS的基本认证RESTAPI?

使用Ionic和AngularJS的基本认证RESTAPI?,angularjs,cakephp,ionic,Angularjs,Cakephp,Ionic,我正在使用ionic和angularjs创建一个应用程序。现在我想连接到一个Web服务,但我不知道如何才能做到这一点。我的Web服务使用基本身份验证进行连接,我正在寻找一些解决方案来创建与Web服务的连接 webservice是使用CakePHP创建的,请注意,如果我对Android或iOS使用本机语言,我可以连接,例如在Android上,我使用Volley API连接,但使用AngularJS我不能 如何使用Basic Auth与AngularJS连接到Web服务上 我正在试这个 服务 例外情

我正在使用ionic和angularjs创建一个应用程序。现在我想连接到一个Web服务,但我不知道如何才能做到这一点。我的Web服务使用基本身份验证进行连接,我正在寻找一些解决方案来创建与Web服务的连接

webservice是使用CakePHP创建的,请注意,如果我对Android或iOS使用本机语言,我可以连接,例如在Android上,我使用Volley API连接,但使用AngularJS我不能

如何使用Basic Auth与AngularJS连接到Web服务上

我正在试这个

服务

例外情况

webservice CakePHP方法


您是否有可能使用爱奥尼亚的实时预览?如果你是,这可能是一个已知的问题。我有解决方案。我在Chrome上安装了一个扩展来启用CORS,现在可以正常工作了。谢谢
var app = angular.module("starter");

app.service("UserLoginAPI", function($http, AppConstants, Base64){
    this.doLogin = function(){
        var _url = AppConstants.webServiceUrl + "/users/testaWS.json";
        var _authdata = Base64.encode('user' + ':' + 'password');   

        return $http.post(_url, {
            headers: { 'Content-Type' : 'application/json; charset=UTF-8',
                       'Authorization' : 'Basic ' + _authdata
                    }
        });

    };
});
XMLHttpRequest cannot load http://192.168.1.105/AppPanel/users/testaWS.json. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. The response had HTTP status code 401.
public function testaWS(){            
            $this->autoRender = false;                         
            return json_encode(array("message"=>"connected!"));
        }