$sce:itype Attempted to trust a non-string value in a content requiring a string: Context: resourceUrl

人盡茶涼 提交于 2019-12-03 15:59:43
Aravinth

I found solution : External resource not being loaded by AngularJs

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

Then specify the filter in ng-src:

   <audio 
        ng-src="{{tones.tonePath | trusted}}" />
    </audio>

Thanks for response.

//first Take data from api 

$scope.Data= JSLINQ(data.Data).Select(function (Item) { return Item; })                    

//Map data as trustable to scope
$scope.Data.items.map(function (i) {
                     i.Header1 = $sce.trustAsHtml(i.Header1);     
                 });

//UI bind modal data

<p ng-bind-html="x1.Header1 " ng-show="x1.Header1 != null"></p>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!