标签: angularjs
自angular1.2起停止工作 (text.text是HTML)
<div ng-repeat="text in texts" ng-bind-html-unsafe="text.text">{{text.text}}</div>
知道如何让它恢复正常吗?
答案 0 :(得分:0)
如果您使用的是角度1.2
angular.module("app").controller("myCtrl", ["$scope", "$sce", function ($scope, $sce) { $scope.htmlString = $sce.trustAsHtml("<h1>HTML</h1>"); }]); <span ng-bind-html="htmlString"></span>
<强> DEMO 强>