1. 不转义html
controller
mod.controller('smartMsgBoxCtrl', ['$scope', '$sce', 'restService', '$location', '$filter', '$stateParams',
function($scope, $sce, restService, $location, $filter, $stateParams) {
var self = this;
self.renderEmotion = function(message){
var content = AnalyticEmotion(message);
return $sce.trustAsHtml(content);
}
}
]);
template
<div class="detail" ng-bind-html="msgBox.renderEmotion(message.text)">
2. 时间格式化
$filter('date')(new Date(msg.created_at),'yyyy-MM-dd HH:mm:ss');