ItSolutionStuff.com

Angular Currency Pipe Example | Currency Pipe in Angular

By Hardik Savani • May 2, 2024
Angular

Hello all! In this article, we will talk about angular currency pipe example. you will learn currency pipe angular example. i explained simply step by step angular pipe currency example. if you have question about angular pipe currency tutorial then i will give simple example with solution.

In this tutorial i will provide you full example and how to use angular currency pipe in component file. you can use it in angular 6, angular 7, angular 8, angular 9, angular 10, angular 11, angular 12, angular 13, angular 14, angular 15, angular 16 and angular 17 application.

I am not going to explain more and more description but i will simply give you syntax and some small examples so you can easily use it in your application.

Syntax:

{{ value_expression | currency [ : currencyCode [ : display [ : digitsInfo [ : locale ] ] ] ] }}

Default Example

import { Component } from '@angular/core';

@Component({

selector: 'my-app',

template: `

<div>

<p>{{ myCurrency | currency }}</p>

</div>`,

styleUrls: [ './app.component.css' ]

})

export class AppComponent {

myCurrency = 100;

}

Output:

$100.00

Currency with Type Example

import { Component } from '@angular/core';

@Component({

selector: 'my-app',

template: `

<div>

<p>{{ myCurrency | currency: 'CAD' }}</p>

<p>{{ myCurrency2 | currency: 'INR' }}</p>

</div>`,

styleUrls: [ './app.component.css' ]

})

export class AppComponent {

myCurrency = 100;

myCurrency2 = 200;

}

Output:

CA$100.00

₹200.00

Currency with Type and Symbol Example

import { Component } from '@angular/core';

@Component({

selector: 'my-app',

template: `

<div>

<p>{{ myCurrency | currency: 'USD': 'symbol':'4.2-2' }}</p>

</div>`,

styleUrls: [ './app.component.css' ]

})

export class AppComponent {

myCurrency = 100.330;

}

Output:

$0,100.33

I hope it can help you...

Tags: Angular
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Pass Multiple Parameters to Pipe in Angular?

Read Now →

Angular Nl2br Pipe Example

Read Now →

Angular NgModel Example | NgModel Directive In Angular

Read Now →

Angular NgStyle Example | NgStyle Directive In Angular

Read Now →

Angular NgClass Example | NgClass Directive In Angular

Read Now →

Angular 9 Reactive Form Validation Example

Read Now →

Angular Get Active Route URL Example

Read Now →

Angular Material Datepicker Example

Read Now →

How to Create Custom Pipe in Angular 9/8?

Read Now →