文章詳情頁
angular.js - angularjs的ng-include的html必須是要在同一個服務器嗎?
瀏覽:117日期:2024-03-13 16:15:16
問題描述
想實現其他服務器的播放器到當前頁面中,求問應該怎么實現?
問題解答
回答1:使用ng-include引入的文件必須是同一個域名下,所以想要實現的可能需要另辟蹊徑了
回答2:默認是同源策略,如果你想加載其他不在同一個域的資源,你需要了解 $sce,設置白名單這是官網一段描述
By default, the template URL is restricted to the same domain and protocol as the application document. This is done by calling $sce.getTrustedResourceUrl on it. To load templates from other domains or protocols you may either whitelist them or wrap them as trusted values. Refer to Angular’s Strict Contextual Escaping.
標簽:
HTML
上一條:angular.js - angular中的controller 的js文件如何修改css樣式比如margin:0?下一條:前端 - 應該先從angularJS , vue.js , react 這些框架中的哪個開始入手?
相關文章:
排行榜
