【问题标题】:Can't access another http resource from ionic app无法从 ionic 应用程序访问另一个 http 资源
【发布时间】:2016-06-02 00:31:45
【问题描述】:

我正在使用 Ionic 框架,我正在尝试在我的 Ionic 框架中使用 $http 服务访问 Restful API,我在控制台中收到以下错误。

XMLHttpRequest cannot load https://apiexample.com/token/ 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 405.

有人知道如何使用 $http 服务从我的 Angular Js 访问 Rest 完整 API 吗?

任何帮助将不胜感激,在此先感谢:D

【问题讨论】:

    标签: angularjs ionic-framework xmlhttprequest


    【解决方案1】:

    这是您需要在服务器端启用的设置。确保您在服务器端具有正确的 CORS 设置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-21
      • 2013-12-07
      • 2021-01-15
      相关资源
      最近更新 更多