How do I used angularjs translator conditionally for HTML label

情到浓时终转凉″ 提交于 2019-12-25 06:38:07

问题


How do I use angular translator for below condition?

<label class="control-label col-md-3">{{vm.showVat ?  Inclusive  :   Amount}} </label>

回答1:


You can use the translate filter in this way:

{{vm.showVat ? 'Inclusive' : 'Amount' | translate}}"

Where 'Inclusive' and 'Amount' are the keys for the translated values




回答2:


How calling a method that returns you translated text. You can put as much logic as you like in there and it is much easier to test than using angular.element



来源:https://stackoverflow.com/questions/32781875/how-do-i-used-angularjs-translator-conditionally-for-html-label

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!