Home Web Front-end JS Tutorial Operation Angularjs cross-domain whitelist setting

Operation Angularjs cross-domain whitelist setting

Jun 07, 2018 pm 02:52 PM
angularjs Cross domain

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$sceDelegateProviderThe 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} 
})
Copy after login

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solution to PHP Session cross-domain problem Solution to PHP Session cross-domain problem Oct 12, 2023 pm 03:00 PM

Solution to PHP Session cross-domain problem

How to make cross-domain requests in Vue? How to make cross-domain requests in Vue? Jun 10, 2023 pm 10:30 PM

How to make cross-domain requests in Vue?

How to use Flask-CORS to achieve cross-domain resource sharing How to use Flask-CORS to achieve cross-domain resource sharing Aug 02, 2023 pm 02:03 PM

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

The latest 5 angularjs tutorials in 2022, from entry to mastery The latest 5 angularjs tutorials in 2022, from entry to mastery Jun 15, 2017 pm 05:50 PM

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

How to allow cross-domain use of images and canvas in HTML? How to allow cross-domain use of images and canvas in HTML? Aug 30, 2023 pm 04:25 PM

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 Use PHP and AngularJS to build a responsive website to provide a high-quality user experience Jun 27, 2023 pm 07:37 PM

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

Build web applications using PHP and AngularJS Build web applications using PHP and AngularJS May 27, 2023 pm 08:10 PM

Build web applications using PHP and AngularJS

Analyze PHP Session cross-domain error log processing Analyze PHP Session cross-domain error log processing Oct 12, 2023 pm 01:42 PM

Analyze PHP Session cross-domain error log processing

See all articles