如何在 AngularJS 中显示无穷大符号



我想在我的网页中有条件地显示一个值或一个无穷大符号。

我想做这样的事情..

<td class="rs-table-text" ng-if="batch.est_completion_time ">{{batch.est_completion_time}}</td>

那是if batch.est_completion_time is not empty then display whatever is coming from json.

json看起来像:

{
  "batch_queue_name": "Batch Five",
  "start_date": "05/01/2017 12:18 A.M.",
  "end_date": "08/01/2017 03:37 A.M.",
  "est_completion_time":"&infin;",
  "completion_status": "42"
}

it does not display the infinity symbol. Rather , it displays the &infin; text only.

如何实现相同的目标?

在控制器中,按如下方式准备数据:

$scope.est_completion_time = $sce.trustAsHtml(batch.est_completion_time);

在您的 HTML 中,您可以按原样显示它。不要忘记在外部 DOM 元素中添加ng-bind-html

仅添加ng-bind-html即可完成工作:

ng-bind-html="batch.est_completion_time"

最新更新