ove
ove

Reputation: 3202

AUD currency format

I would like to have the following Australian currency format using angular.

$50 AUD

Trying to use the currency pipe but looks like there is no easy way to do it.

Any idea?

Upvotes: 0

Views: 990

Answers (2)

JossFD
JossFD

Reputation: 2216

The currency pipe doesn't seem to support the format you want out of the box.

You should probably just make your own pipe for it. Something like:

import { Pipe } from "@angular/core";

@Pipe({
  name: "aud",
  pure: true
})
export class AudDirective {
  transform(value: number | string, args?: any): any {
    return "$" + value + " AUD";
  }
}

Here's a working Stackblitz for it (feel free to expand the Pipe code to make it more robust/modulable)

Upvotes: 1

Srikar Phani Kumar M
Srikar Phani Kumar M

Reputation: 1384

there is an angular pipe called 'Currency Pipe' which you can use to format the value to a particular country's currency.

Please check this stackblitz for Australian Dollar

https://stackblitz.com/edit/angular-ivy-txzp1b?file=src%2Fapp%2Fapp.component.html

Codes: USA ==> USD, Canada ==> CAD, Australia ==> AUD, India ==> INR

Upvotes: 0

Related Questions