開啟不同網域的內容時報下面的錯誤:
Blocked loading resource from url not allowed by $sceDelegate policy
解決方案:
app.config(function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from our assets domain. Notice the difference between * and **.
'http://media.w3.org/**']);
});
很簡單的方法就解決了angularjs跨域使用iframe的問題,希望大家能夠喜歡