0

This code doesn't work all the time. Sometimes I get a 404 error.

<iframe ng-src="http://www.dailymotion.com/embed/video/{{vid.id}}?autoPlay=0" width="100%" height="100%" frameborder="0"></iframe>

This code works all the time.

<iframe src="http://www.dailymotion.com/embed/video/{{vid.id}}?autoPlay=0" width="100%" height="100%" frameborder="0"></iframe>

I'm not sure I understand the purpose of ng-src anymore. Is it because it's an iframe?

JMaylin
  • 1,378
  • 4
  • 15
  • 38
  • 1
    Take a look , little bit different approach: http://jsfiddle.net/cherniv/tkRnp/ – Ivan Chernykh Oct 16 '13 at 09:20
  • That's an interesting approach, but it works perfectly with "src", so I think I'll stick with it. My question is: Why does it work? :D – JMaylin Oct 16 '13 at 09:26
  • 1
    ng-src should work, but if you're using an explicit link like that one then ng-src provides no benefit over src anyway - ng-src is for ensuring that {{ expressions }} are resolved before the link is displayed – Dan Oct 16 '13 at 10:16
  • Actually, your solution is better because I can check if the id exists (controller side). – JMaylin Oct 18 '13 at 09:47
  • @JMaylin: See http://stackoverflow.com/questions/19289402/angular-js-scope-var-value-in-iframe Apparently string urls can't be concatenated in the src property for security reasons. – Damian Green Sep 04 '14 at 14:06

0 Answers0