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
是的,在video
插入src
或ng-src
似乎已损坏,每当videoSrc
更改时, videoSrc
在指令的链接函数中手动创建元素。
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>'
}
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.