簡體   English   中英

如何在AngularJS中顯示無窮大符號

[英]How to display infinity symbol in 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. 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"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM