我正在研究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
答案 0 :(得分:1)
这是您需要在服务器端启用的设置。确保在服务器端具有正确的CORS设置。