search
HomeWeb Front-endJS TutorialOperation 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$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>   </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!

Statement
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
Vue 中如何进行跨域请求?Vue 中如何进行跨域请求?Jun 10, 2023 pm 10:30 PM

Vue是一种流行的JavaScript框架,用于构建现代化的Web应用程序。在使用Vue开发应用程序时,常常需要与不同的API交互,而这些API往往位于不同的服务器上。由于跨域安全策略的限制,当Vue应用程序在一个域名上运行时,它不能直接与另一个域名上的API进行通信。本文将介绍几种在Vue中进行跨域请求的方法。1.使用代理一种常见的跨域解决方案是使用代理

如何使用Flask-CORS实现跨域资源共享如何使用Flask-CORS实现跨域资源共享Aug 02, 2023 pm 02:03 PM

如何使用Flask-CORS实现跨域资源共享引言:在网络应用开发中,跨域资源共享(CrossOriginResourceSharing,简称CORS)是一种机制,允许服务器与指定的来源或域名之间共享资源。使用CORS,我们可以灵活地控制不同域之间的数据传输,实现安全、可靠的跨域访问。在本文中,我们将介绍如何使用Flask-CORS扩展库来实现CORS功

2022年最新5款的angularjs教程从入门到精通2022年最新5款的angularjs教程从入门到精通Jun 15, 2017 pm 05:50 PM

Javascript 是一个非常有个性的语言. 无论是从代码的组织, 还是代码的编程范式, 还是面向对象理论都独具一格. 而很早就在争论的Javascript 是不是面向对象语言这个问题, 显然已有答案. 但是, 即使 Javascript 叱咤风云二十年, 如果想要看懂 jQuery, Angularjs, 甚至是 React 等流行框架, 观看《黑马云课堂JavaScript 高级框架设计视频教程》就对了。

如何在HTML中允许跨域使用图像和画布?如何在HTML中允许跨域使用图像和画布?Aug 30, 2023 pm 04:25 PM

为了允许跨域使用图像和画布,服务器必须在其HTTP响应中包含适当的CORS(跨域资源共享)头。这些头可以设置为允许特定的来源或方法,或者允许任何来源访问资源。HTMLCanvasAnHTML5CanvasisarectangularareaonawebpagethatiscontrolledbyJavaScriptcode.Anythingcanbedrawnonthecanvas,includingimages,shapes,text,andanimations.Thecanvasisagre

使用PHP和AngularJS搭建一个响应式网站,提供优质的用户体验使用PHP和AngularJS搭建一个响应式网站,提供优质的用户体验Jun 27, 2023 pm 07:37 PM

在如今信息时代,网站已经成为人们获取信息和交流的重要工具。一个响应式的网站能够适应各种设备,为用户提供优质的体验,成为了现代网站开发的热点。本篇文章将介绍如何使用PHP和AngularJS搭建一个响应式网站,从而提供优质的用户体验。PHP介绍PHP是一种开源的服务器端编程语言,非常适用于Web开发。PHP具有很多优点,如易于学习、跨平台、丰富的工具库、开发效

使用PHP和AngularJS构建Web应用使用PHP和AngularJS构建Web应用May 27, 2023 pm 08:10 PM

随着互联网的不断发展,Web应用已成为企业信息化建设的重要组成部分,也是现代化工作的必要手段。为了使Web应用能够便于开发、维护和扩展,开发人员需要选择适合自己开发需求的技术框架和编程语言。PHP和AngularJS是两种非常流行的Web开发技术,它们分别是服务器端和客户端的解决方案,通过结合使用可以大大提高Web应用的开发效率和使用体验。PHP的优势PHP

Vue技术开发中遇到的跨域问题及解决方法Vue技术开发中遇到的跨域问题及解决方法Oct 08, 2023 pm 09:36 PM

Vue技术开发中遇到的跨域问题及解决方法摘要:本文将介绍在Vue技术开发过程中,可能遇到的跨域问题以及解决方法。我们将从导致跨域的原因开始,然后介绍几种常见的解决方案,并提供具体代码示例。一、跨域问题的原因在Web开发中,由于浏览器的安全策略,浏览器会限制从一个源(域、协议或端口)请求另一个源的资源。这就是所谓的“同源策略”。当我们在Vue技术开发中,前端与

在Beego框架中使用CORS解决跨域问题在Beego框架中使用CORS解决跨域问题Jun 04, 2023 pm 07:40 PM

随着Web应用程序的发展和互联网的全球化,越来越多的应用程序需要进行跨域请求。对于前端开发人员而言,跨域请求是一个常见的问题,它可能导致应用程序无法正常工作。在这种情况下,解决跨域请求问题的最佳方法之一是使用CORS。在本文中,我们将重点介绍如何在Beego框架中使用CORS解决跨域问题。什么是跨域请求?在Web应用程序中,跨域请求是指从一个域名的网页向另一

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft