Angular JS Handling Ng-Repeated HTML5 Video & $SCE

后端 未结 1 1129
时光说笑
时光说笑 2020-12-14 14:12

JSfiddle here: http://jsfiddle.net/TegFf/73/

From this answer, I understand Angular 1.2 ships with Strict Contextual Escaping (SCE) enabled. This affects the parser

相关标签:
1条回答
  • 2020-12-14 14:24

    It looks like what you want is to whitelist the domain these videos will be served from. You can do this using $sceDelegateProvider

    All you need to do is add a bit of config as follows:

    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/**']);
    });
    

    I've updated your fiddle with a working demo: http://jsfiddle.net/spikeheap/ACJ77/1/

    0 讨论(0)
提交回复
热议问题