0

I am trying to get ng-src to work in an iframe, but I can't seem to figure it out. Is it possible?

<div class="row" ng-init="video='http://www.youtube.com/embed/gMW8jUX14Y0'">
  <div class="col-md-12">
    <!-- 16:9 aspect ratio -->
    <div class="embed-responsive embed-responsive-16by9">
      <iframe class="embed-responsive-item" ng-src="{{ video }}"></iframe>
    </div>     
  </div>
</div>

The page loads a blank iframe and it never refreshes. on the same page I can include this code and it works just fine.

<a ng-href="{{ video }}">Link</a>
Jared Whipple
  • 1,111
  • 3
  • 17
  • 38

1 Answers1

2

iframe and ng-src have been discussed on SO before with a solution using $sce (to trust the URL for ng-src='URL')
link: AngularJS ng-src inside of iframe
link: Unable to load url into iframe via AngularJS controller
link: How to set an iframe src attribute from a variable in AngularJS

GL!

Community
  • 1
  • 1
Shehryar Abbasi
  • 378
  • 2
  • 8