iFrame with ng-src says can't interpolate

16,179 views
Skip to first unread message

Alexander Kohout

unread,
Aug 21, 2013, 9:22:12 AM8/21/13
to ang...@googlegroups.com
Until Angular 1.1.5 I used the following code to display a Youtube video via an iFrame:

<iframe style="width:100%" ng-src="{{movie.trailer}}" frameborder=0 allowfullscreen>

Since 1.2.0 this breaks with the following error message:
Error: [$interpolate:interr] Can't interpolate: {{ movie.trailer }}
Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.  URL: ...

It seems to have something to do with $sce, but I can't really understand what's going on there. Can anybody help me out? Thanks in advance!

Chris Huston

unread,
Aug 21, 2013, 11:41:02 AM8/21/13
to ang...@googlegroups.com

Alexander Kohout

unread,
Aug 21, 2013, 1:52:52 PM8/21/13
to ang...@googlegroups.com
Works great, thank you!

Michael Calkins

unread,
Oct 6, 2013, 3:49:11 PM10/6/13
to ang...@googlegroups.com
This also works well for mediaelement video directivces.

<video
src='{{ trustSrc(main.videoUrl + upload.filename) }}'
height='400'
width='100%'
preload='auto'
poster='/image/resize/{{ upload.image }}/400/400'
mediaelement>
</video>

Anthony ESTEBE

unread,
Feb 23, 2014, 4:12:29 AM2/23/14
to ang...@googlegroups.com
Another solution is to authorise the URL in your trusted resources

App.config(function($sceDelegateProvider, apiUrl) {
  $sceDelegateProvider.resourceUrlWhitelist([
   'self',
  ];
});

Aaron Freeland

unread,
Apr 5, 2014, 10:23:11 PM4/5/14
to ang...@googlegroups.com
Thanks, saved me lots of time =)

Santhosh Gopalakrishnan

unread,
Jul 7, 2017, 1:36:37 AM7/7/17
to Angular and AngularJS discussion
doesnt work for https links

Chris Huston

unread,
Jul 7, 2017, 11:08:31 AM7/7/17
to Angular and AngularJS discussion
https links do work. See Plunker below with working https links:


You just need to have a link to a video source that does not require same_origin.
Reply all
Reply to author
Forward
0 new messages