In Angular you can use the currency filter to format a number, like like this:
在Angular中,您可以使用货币过滤器来格式化数字,如下所示:
{{service.price | currency: "€ "}}
the standard output is
标准输出是
€ #,##0.00
How can the output be:
如何输出:
€ #.##0,00
(European notation)
(欧洲表示法)
1 个解决方案
#1
27
Angular supports i18n
Standard for location | globalization | internationalization. When it comes to number formatting Angular relies on $locale
service and more specifically on the property NUMBER_FORMATS
.
Angular支持i18n标准位置|全球化|国际化。在数字格式方面,Angular依赖于$ locale服务,更具体地说,依赖于NUMBER_FORMATS属性。
The currency symbol by itself will not change the numbering formatting unless you change the 'location'.
除非您更改“位置”,否则货币符号本身不会更改编号格式。
Here is the list of locations currently supported by angular:
以下是angular目前支持的位置列表:
http://cdnjs.com/libraries/angular-i18n/
http://cdnjs.com/libraries/angular-i18n/
Here is an example on how to support german locale:
以下是如何支持德语语言环境的示例:
<html ng-app>
<head>
<script src="angular.js"></script>
<script src="i18n/angular-locale_de-de.js"></script>
</head>
</html>
If you want to dig more into it you can search for NUMBER_FORMATS
in any of the CDNs provided above and you will find what angular will use to format your numbers, this is an example:
如果你想深入了解它,你可以在上面提供的任何CDN中搜索NUMBER_FORMATS,你会发现用什么角度来格式化你的数字,这是一个例子:
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u20ac",
"DECIMAL_SEP": ",",
"GROUP_SEP": ".",
...
#1
27
Angular supports i18n
Standard for location | globalization | internationalization. When it comes to number formatting Angular relies on $locale
service and more specifically on the property NUMBER_FORMATS
.
Angular支持i18n标准位置|全球化|国际化。在数字格式方面,Angular依赖于$ locale服务,更具体地说,依赖于NUMBER_FORMATS属性。
The currency symbol by itself will not change the numbering formatting unless you change the 'location'.
除非您更改“位置”,否则货币符号本身不会更改编号格式。
Here is the list of locations currently supported by angular:
以下是angular目前支持的位置列表:
http://cdnjs.com/libraries/angular-i18n/
http://cdnjs.com/libraries/angular-i18n/
Here is an example on how to support german locale:
以下是如何支持德语语言环境的示例:
<html ng-app>
<head>
<script src="angular.js"></script>
<script src="i18n/angular-locale_de-de.js"></script>
</head>
</html>
If you want to dig more into it you can search for NUMBER_FORMATS
in any of the CDNs provided above and you will find what angular will use to format your numbers, this is an example:
如果你想深入了解它,你可以在上面提供的任何CDN中搜索NUMBER_FORMATS,你会发现用什么角度来格式化你的数字,这是一个例子:
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u20ac",
"DECIMAL_SEP": ",",
"GROUP_SEP": ".",
...