angularjs的ng-include的html必须是要在同一个服务器吗?

想实现其他服务器的播放器到当前页面中,求问应该怎么实现?

阅读 2.1k
2 个回答

使用ng-include引入的文件必须是同一个域名下,所以想要实现的可能需要另辟蹊径了

默认是同源策略,如果你想加载其他不在同一个域的资源,你需要了解 $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.
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进