AngularJS- currencyFilter


Beispiel

Zeigen Sie die Zahl als Währungsformat an:

<div ng-app="myApp" ng-controller="costCtrl">

<p>Price = {{ price | currency }}</p>

</div>

Definition und Verwendung

Der currencyFilter formatiert eine Zahl in ein Währungsformat.

Standardmäßig wird das lokale Währungsformat verwendet.


Syntax

{{ number | currency : symbol : fractionsize }}

Parameterwerte

Value Description
symbol Optional. The currency symbol to be displayed. The symbol can be any character or text.
fractionsize Optional. The number of decimals.


Mehr Beispiele

Beispiel

Zeigen Sie den Preis im norwegischen Währungsformat an:

<div ng-app="myApp" ng-controller="costCtrl">

<p>Price = {{ price | currency : "NOK" }}</p>

</div>

Beispiel

Zeigen Sie den Preis mit drei Dezimalstellen an:

<div ng-app="myApp" ng-controller="costCtrl">

<p>Price = {{ price | currency : "NOK" : 3 }}</p>

</div>

Verwandte Seiten

AngularJS-Tutorial: Winkelfilter