[英]How to display infinity symbol in AngularJS
I want to conditionally display a value or an infinity symbol in my Web Page. 我想在我的网页中有条件地显示值或无穷大符号。
I wanted to do something like this .. 我想做这样的事......
<td class="rs-table-text" ng-if="batch.est_completion_time ">{{batch.est_completion_time}}</td>
That is if batch.est_completion_time is not empty then display whatever is coming from json
. 也就是说,
if batch.est_completion_time is not empty then display whatever is coming from json
。
And the json
looks like : 而
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":"∞",
"completion_status": "42"
}
But it does not display the infinity symbol. Rather , it displays the ∞ text only.
但
it does not display the infinity symbol. Rather , it displays the ∞ text only.
it does not display the infinity symbol. Rather , it displays the ∞ text only.
How to achieve the same ? 如何实现相同?
In your controller, prepare the data as following : 在控制器中,准备如下数据:
$scope.est_completion_time = $sce.trustAsHtml(batch.est_completion_time);
In your HTML, you can display it as it is. 在HTML中,您可以按原样显示它。 Don't forget to add
ng-bind-html
in the outer DOM element. 不要忘记在外部DOM元素中添加
ng-bind-html
。
Adding only ng-bind-html
can do the job : 仅添加
ng-bind-html
可以完成这项工作:
ng-bind-html="batch.est_completion_time"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.