How to set an iframe src attribute from a variable in AngularJS

后端 未结 6 1180
旧时难觅i
旧时难觅i 2020-11-22 17:24

I\'m trying to set the src attribute of an iframe from a variable and I can\'t get it to work...

The markup:

6条回答
  •  难免孤独
    2020-11-22 17:57

    this way i follow and its work for me fine, may it will works for you,

    
    

    here trustThisUrl is just filter,

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

提交回复
热议问题