Angularjs - 显示是/否的真/假 [英] Angularjs - Show True/False as Yes/No
本文介绍了Angularjs - 显示是/否的真/假的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种简单的方法可以将真/假值显示为是/否?
Is there a simple way to show a true/false value as yes/no?
我正在从数据库中检索包含以下内容的JSON:
I am retrieving from the Database a JSON that contains :
[Object,Object,WithCertification:true]
[Object, Object, "WithCertification": true]
这是html:
认证 {{elem.WithCertification}}
显示:
认证真实
我希望它显示:
认证是
有没有办法不必去控制器将真/假更改为是/否?
Is there a way without having to go to the controller to change the true/false to yes/no?
无论如何我需要改变它,有什么建议吗?
Anyhow I need to change it, any suggestions?
谢谢。
推荐答案
你可以三元运营商 ide Angular Expressions ,所以只需这样做:
You can have ternary operators inside Angular Expressions, so just do this:
With Certification {{elem.WithCertification?'yes':'no'}}
这篇关于Angularjs - 显示是/否的真/假的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文