AngularJS multiple expressions concatenating in interpolation with a URL

前端 未结 4 2131
太阳男子
太阳男子 2020-11-29 04:50

I know this is long, but please bear with me. The problem is easy to understand, just takes some writing to fully explain it.

Right now I\'m getting this error

4条回答
  •  悲&欢浪女
    2020-11-29 05:40

    in controller:

    app.filter('trustAsResourceUrl', ['$sce', function ($sce) {
        return function (val) {
            return $sce.trustAsResourceUrl(val);
        };
    }]);
    

    in html:

    ng-src="('https://www.youtube.com/embed/' + video.id.videoId) | trustAsResourceUrl"
    

提交回复
热议问题