angular json转义html

第一步json输出的内容反编码

function htmldecode(s){
var div = document.createElement('div');
div.innerHTML = s;
return div.innerText || div.textContent;
}

第二步 angular.module注册ngSanitize模块

第三步 模板页绑定数据  ng-bind-html=""

有空再排版。。

原文地址:https://www.cnblogs.com/light-j/p/4651310.html