一、將此過濾器添加到ng-bind-html所綁定的數據中,便實現了在數據加載時對於html標籤的自動轉義。html
<div ng-repeat="item in list" > <div ng-bind-html="item.content |trustHtml"></div> </div>
2.項目中若是ng-repeat = 「item in list」spa
<li ng-repeat="item in msgList" class="clr" > <div class="chat-dialog-time" ng-show= "item.send_time1 != ''">{{item.send_time1}}</div> <!--<div ng-class="{true: 'chat-dialog-news-mine', false: 'chat-dialog-news-other'}[{{item.isOwn}}]"
msgId="{{item.imdn_id}}">--> <div ng-class="{'chat-dialog-news-mine':{{item.isOwn}},'chat-dialog-news-other':{{!item.isOwn}},
'chat-dialog-news-file':{{item.content_type == 6}},'chat-dialog-news-mine-file':{{item.isOwn}}&&{{item.content_type == 6}},
'chat-dialog-news-other-file':{{!item.isOwn}}&&{{item.content_type == 6}}}" msgId="{{item.imdn_id}}"> <div contextmenu="supermenu" ng-right-click="decrementRight($event,item)"> <i class="icon warn-icon" ng-if="item.isWarn" ng-click="reSendFile(item)"></i> <i ng-class="{true: 'icon {{item.status}}', false: ''}[{{item.isOwn && item.status !== ''}}]"></i> <i ng-class="{true: 'bubble-icon right-icon', false: 'bubble-icon left-icon'}[{{item.isOwn}}]"></i> <span compile='item.content|trustHtml' ng-click="newsClick($event, item)"
ng-dblclick="newsDBClick($event, item)"></span> </div> <!--<span ng-if="!item.isWarn" ng-show="{{item.need_read_report==1||item.need_read_report}}" ng-class="{true: 'chat-news-read', false: 'chat-news-unread'}[{{item.is_read==1}}]">--> <!--{{item.is_read_report==1?'已讀':'未讀'}}--> <!--</span>--> </div>