1. 程式人生 > >angularjs中避免被轉義,HTMl標識能被識別,可以正常鏈接,下載!

angularjs中避免被轉義,HTMl標識能被識別,可以正常鏈接,下載!

strong mes logs str style content 代碼 ret .html

http://www.cnblogs.com/sxz2008/p/6434036.html
如果希望正常解析html代碼,如下:

var app = angular.module(‘main.app‘, [‘bw.paging‘, ‘cbc.datePicker‘, ‘angular-popups‘]).filter(

‘to_trusted‘, [‘$sce‘, function ($sce) {

return function (text) {

return $sce.trustAsHtml(text);

}

}] );

註意加下劃線部分

<div class="bdall br4 w484 pull-left ml4 pall6" ng-bind-html="selectedmessages.content | to_trusted

"></div>

angularjs中避免被轉義,HTMl標識能被識別,可以正常鏈接,下載!