AngularJS performs an OPTIONS HTTP request for a cross-origin resource

后端 未结 14 1704
生来不讨喜
生来不讨喜 2020-11-22 03:04

I\'m trying to setup AngularJS to communicate with a cross-origin resource where the asset host which delivers my template files is on a different domain and therefore the X

14条回答
  •  礼貌的吻别
    2020-11-22 03:27

    If you are using a nodeJS server, you can use this library, it worked fine for me https://github.com/expressjs/cors

    var express = require('express')
      , cors = require('cors')
      , app = express();
    
    app.use(cors());
    

    and after you can do an npm update.

提交回复
热议问题