1 引入 angular-sanitize.js
2 依赖注入 var app = angular.module("app", [‘ngSanitize‘])
3ng-bind-html=""
---------------------------
html 部分
<body ng-app="app" >
<div ng-controller="list">
<div ng-bind-html="pureHtml"> //原文绑定
</div>
</div>
--------------------------------
script部分
<script type="text/javascript">
var app = angular.module("app", [‘ngSanitize‘]) // 依赖注入
app.controller("list", function($scope, $http) {
$scope.pureHtml = "<p>asdasdas</p>" //定义原文
})
</script>
时间: 2024-11-08 22:18:57