0

videoSrc variable not evaluating properly

images/{{videoSrc}}.mp4 

if i'm writing only videoSrc then its working propely but while concating with other string it is not working

see jsfiddle

2 Answers 2

1

Yeah interpolating src or ng-src in video seems broken, you'll probably best off creating the elements by hand in your directive's link function whenever videoSrc changes.

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

Comments

0

You can use template: fn way see example bellow

angular.module('myApp', []).directive('videoPopup', function() {
    return {
        strict: 'A',
        scope: {
            videoSrc: '@'
        },
        replace:true,
        template: function(tElem, tAttrs){
            return '<video width="100%" controls><source 
src="images/'+tAttrs.videoSrc+'.mp4" type="video/mp4"><source src="images/'+tAttrs.videoSrc+'.webm" type="video/webm"></video>'

        } 
    }
});

working fiddle

Comments

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.