我有一些值,例如 1000, 2000, <b>3000</b>, <4000>, <b>5000</b>
内部 JSON 作为 API 响应。我想在表格中呈现此响应。所以我尝试了ng-bind-html。但它只显示带有 3000,5000 等标签的值。我想将所有值 1000,2000,4000 显示为纯字符串,将 3000,5000 显示为粗体/或任何其他 HTML 标记。
angular.forEach($scope.arr2.test,function(item)
$scope.res=$sce.trustAsHtml(item.amount);
return $scope.res;
});
在 HTML 方面,我有这样的东西
<td id="price" class="edit" ng-repeat="pro in d.procedure" ng-bind-html="valueCheck(d._id,pro._id,hos._id)"></td>
最佳答案
关于javascript - 从字符串渲染 html 标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40480429/