currencyFilter AngularJS


Contoh

Menampilkan nomor sebagai format mata uang:

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

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

</div>

Definisi dan Penggunaan

Filter currencymemformat angka ke format mata uang.

Secara default, format mata uang lokal digunakan.


Sintaksis

{{ number | currency : symbol : fractionsize }}

Nilai Parameter

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


Lebih Banyak Contoh

Contoh

Tampilkan harga dalam format mata uang Norwegia:

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

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

</div>

Contoh

Tampilkan harga dengan tiga desimal:

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

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

</div>

Halaman Terkait

Tutorial AngularJS: Filter Sudut