Getting $sce error with source tag (1.2rc1)

893 views
Skip to first unread message

Daryll Strauss

unread,
Aug 31, 2013, 11:47:45 AM8/31/13
to ang...@googlegroups.com

I'm working with 1.2rc1 and I've got audio pulling from a value in a controller.


but the key part is:
<audio><source ng-src="{{audio.url}}"></audio>

I get $sce errors:

Error: [$interpolate:interr] Can't interpolate: {{single.audio}}
Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.  URL: http://www.freesound.org/data/previews/87/87020_377011-lq.mp3

I've tried with and without trustAsUrl (even though docs say that isn't implemented) and as src= and ng-src=. No dice.

Any suggestions?

Etienne Folio

unread,
Sep 2, 2013, 7:46:43 PM9/2/13
to ang...@googlegroups.com
Same error for me with :

video
  source(ng-repeat='file in video.files', ng-src='{{file.src}}', type='video/{{file.type}}')

The video object comes from a $resource call and points on DMCloud…

Anyone help?

Etienne Folio

unread,
Sep 2, 2013, 8:14:27 PM9/2/13
to ang...@googlegroups.com
Ok, I found 2 ways to remove the error:

ng-src='{{trustSrc(file.src)}}'

and

.config(function($sceDelegateProvider) {
  $sceDelegateProvider.resourceUrlWhitelist([
    '^http://localhost',
    '^http://cdn.dmcloud.net/'
  ]);
});



Honestly, I prefer the former :)

I still can't make my videos to play, but this error seems solved for me now…

Jose Luis Rivas

unread,
Sep 2, 2013, 8:18:56 PM9/2/13
to ang...@googlegroups.com
> now�

Hello Etienne, I think your video isn't playing because the `type=` is
maybe not changed by Angular and the {{}} are there intact. Could you
check that? Maybe you will need to make your own directive for that.

Kind Regards,
--
Jose Luis Rivas
http://joseluisrivas.net/
Reply all
Reply to author
Forward
0 new messages