0
         <div class="small-12 medium-6 large-4 columns" ng-if="video">
            Testing video link: https://www.youtube.com/embed/{{video}}
                <div class="h_iframe">
                    <iframe width="854" height="480" src="https://www.youtube.com/embed/{{video}}?rel=0" frameborder="0" allowfullscreen></iframe>
                </div>
        </div>

I cannot display the embed youtube video on my webpage? I was able to display the Testing video link with valid URL.

In the iframe, my video does not show up. But if I change my src code ('"https://www.youtube.com/embed/{{video}}?rel=0"') to a direct link without the expression, it works. How do i get this to work with using angularjs express?

EDIT: Made some changes from Jane.

<div class="small-12 medium-6 large-4 columns" ng-if="video">
                Testing video link: https://www.youtube.com/embed/{{video}}
                    <div class="h_iframe">
                        <iframe width="854" height="480" ng- src="https://www.youtube.com/embed/{{video}}?rel=0" frameborder="0" allowfullscreen></iframe>
                    </div>
            </div>

Changed from src to ng-src. Now the problem: my Testing video link: https://www.youtube.com/embed/{{video}} doesn't show up. My video doesnt show up.

SOLVED: A linked from Jane in comment has lead to the solution. Thanks.

4
  • what does {{video}} output? Commented Apr 17, 2018 at 19:19
  • the youtube video ID. Commented Apr 17, 2018 at 19:21
  • So if my {{video}} was set on the controller to '33Rs8Swa984'. it will print out Testing video link: youtube.com/embed/33Rs8Swa984 Commented Apr 17, 2018 at 19:22
  • 1
    Possible duplicate of How to change iframe src use angularjs Commented Apr 17, 2018 at 19:27

1 Answer 1

1

The problem is that you are doing a src instead of an ng-src since you are trying to input some angular into the src..

This should work for you, I think:

<iframe width="854" height="480" ng-src="https://www.youtube.com/embed/{{video}}?rel=0" frameborder="0" allowfullscreen></iframe>

You can read more about ng-src here: https://docs.angularjs.org/api/ng/directive/ngSrc

Sign up to request clarification or add additional context in comments.

1 Comment

@Pop-A-Stash {{video}} is a string that get pulled from controller. Its a youtube ID. for example, video can be '33Rs8Swa984'. I have changed to ng-src and it still won't work on my situation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.