0

I like to post the video link on my website but that doesnot work

<div ng-repeat="vid in video">
          <iframe class="embed-responsive-item" width="250px" height="250px" src="https://www.youtube.com/embed/+{{vid.youtube}}" frameborder="0" allowfullscreen></iframe>
          </div>

The above code not working, please help.

user2903536
  • 1,716
  • 18
  • 25
  • What part of it is not working? Are you getting any errors? One thing i spot is you need to use `ng-sr`c instead of `src` if you want the angular to get evaluated in the url. – ajmajmajma Apr 05 '16 at 13:49

1 Answers1

1

You must use the ngSrc attribute as they say in the Angular documentation otherwise your browser tries to fetch the url with "{{vid.youtube}}". Plus you don't need to add a "+", there isn't any on Youtube urls.

EDIT : I actually had the same problem with iFrames, and I forgot about it : you must tell Angular you "trust" the Url given. Take a look a this post, it's exactly the same problem.

Community
  • 1
  • 1
Ilan Coulon
  • 1,126
  • 1
  • 7
  • 14