如何获得特定的货币符号(在我的情况下是卢比符号)在角度js而不是默认货币符号(美元$符号) [英] How to get specific currency symbol(rupee symbol in my case) in angular js instead of the default one (dollar $ symbol)

查看:217
本文介绍了如何获得特定的货币符号(在我的情况下是卢比符号)在角度js而不是默认货币符号(美元$符号)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在角js中使用'货币'时,我得到一个美元符号。如何根据要求获得所需的货币符号。好像现在我需要知道如何使用货币显示卢比符号。如果有人能够解释如何在不同的需求时间使用这种货币用于不同的交易品种,它将非常有用。

When i use 'currency' in angular js, I am getting a dollar symbol. How to get required currency symbols based on the requirements. As if now i need to know how to display a rupee symbol using currency. It will be of great use if anyone could explain how to make use of this currency for different symbols at the times of different requirements.

样本:

Item Price<span style="font-weight:bold;">{{item.price | currency}}</span>

如果我的item.price为200,则显示200 $。我需要显示卢比符号而不是美元。

If my item.price is 200. Here it shows 200$. I need to display rupee symbol instead of dollar.

推荐答案

要在角度js中显示货币符号,您需要为货币符号提供HTML实体以下是通过代码和模板中的示例和用法:

To display currency symbol in angular js you need provide HTML entity for currency symbols below are the examples and usage in through code and in template :

在您的模板Euro示例中:

Inside your Template example of Euro:

Item Price<span style="font-weight:bold;">{{price | currency:"&euro;"}}</span>

Rupee示例:

example of Rupee:

Item Price<span style="font-weight:bold;">{{price | currency:"&#8377;"}}</span>

同时检查以下url

http://www.cs.tut.fi/~jkorpela/html/euro.html

从控制器:

在控制器中注入$ filter

Inject $filter in your controller

$scope.price=$filter('currency')($scope.price,'&euro;')

这篇关于如何获得特定的货币符号(在我的情况下是卢比符号)在角度js而不是默认货币符号(美元$符号)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆