Operation Angularjs cross-domain whitelist setting
Jun 07, 2018 pm 02:52 PMThis time I will bring you the cross-domain whitelist settings for Angularjs. What are the precautions for setting up the whitelist cross-domain for Angularjs? The following is a practical case, let’s take a look.
Inject in config$sceDelegateProvider
The service uses the resourceUrlWhitelist([])
method to add a whitelist
When crossing domains, set the method attribute to "jsonp" can be accessed
app.config(["$sceDelegateProvider",function($sceDelegateProvider){ $sceDelegateProvider.resourceUrlWhitelist([ <span style="white-space:pre;"> </span>//跨域添加白名单 "self", "http://datainfo.duapp.com/**" ]); } ]); $http({ method:"JSONP", url:"http://datainfo.duapp.com/shopdata/getGoods.php", params:{classID:$stateParams.classID} })
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Node uses Puppeteer as a crawler
How Angular ng-animate and ng-cookies are used in the project use
The above is the detailed content of Operation Angularjs cross-domain whitelist setting. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solution to PHP Session cross-domain problem

How to make cross-domain requests in Vue?

How to use Flask-CORS to achieve cross-domain resource sharing

The latest 5 angularjs tutorials in 2022, from entry to mastery

How to allow cross-domain use of images and canvas in HTML?

Use PHP and AngularJS to build a responsive website to provide a high-quality user experience

Build web applications using PHP and AngularJS

Analyze PHP Session cross-domain error log processing
