Home >Web Front-end >JS Tutorial >Operation Angularjs cross-domain whitelist setting
This 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!