AngularJS请求数据提示resource from url not allowed by $sceDelegate policy

AngularJS iframe跨域打开内容时报错

解决方案 使用  $sceDelegateProvider  配置跨域请求域名

config.js

app.config(function($sceDelegateProvider) {
   $sceDelegateProvider.resourceUrlWhitelist([
       // Allow same origin resource loads.
       'self',
       // Allow loading from our assets domain.  Notice the difference between * and **.
       'http://www.baidu.com/**']);
});

xx.js

$sce.trustAsResourceUrl(pdf.Url)

html:

<iframe style="100%; height:1000px;" frameborder="0" ng-src="{{pdf.Url}}"></iframe>
原文地址:https://www.cnblogs.com/jasonlai2016/p/11314951.html