How to display   or any raw html in angular data?

后端 未结 5 1591
后悔当初
后悔当初 2020-12-09 08:29

How can I display   as space not as string. Is there raw filter like in twig?

{{item}}
$scope.item
5条回答
  •  执念已碎
    2020-12-09 08:51

    You can also create a filter for that.

    Filter

    app.filter("trustHtmlContent", ['$sce', $sce => htmlCode => $sce.trustAsHtml(htmlCode)]);
    

    usage

    
    

    src: How do you use $sce.trustAsHtml(string) to replicate ng-bind-html-unsafe in Angular 1.2+

提交回复
热议问题