Angular Material Input Currency Mask Example

By Hardik Savani May 2, 2024 Category : Angular


This tutorial shows you angular material input currency mask. you can see angular material currency mask input. you'll learn currency mask input angular example. you'll learn angular material ng2-currency-mask. So, let's follow few step to create example of ng2-currency-mask example.

you can easily add currency input mast 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 app.

In this example, we will add material design theme and then import some dependency module of input. then we will simply install ng2-currency-mask package for currency mask.

So, let's see bellow example from here:

Step 1: Create New App

You can easily create your angular app using bellow command:

ng new myDatepicker

Step 2: Add Material Design

Now in this step, we need to just install material design theme in our angular application. so let's add as like bellow:

ng add @angular/material

Cmd like bellow:

Installing packages for tooling via npm.

Installed packages for tooling via npm.

? Choose a prebuilt theme name, or "custom" for a custom theme: Indigo/Pink

[ Preview: ]

? Set up HammerJS for gesture recognition? Yes

? Set up browser animations for Angular Material? Yes

Step 3: Install ng2-currency-mask

Now in this step, we need to just install ng2-currency-mask in our angular application. so let's add as like bellow:

npm install ng2-currency-mask --save

Step 4: Import Module

In third step, we need to import some dependency like MatInputModule, CurrencyMaskModule. so let's add.


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

import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { MatFormFieldModule } from '@angular/material/form-field';

import { MatInputModule } from '@angular/material/input';

import { CurrencyMaskModule } from "ng2-currency-mask";


declarations: [



imports: [







providers: [],

bootstrap: [AppComponent]


export class AppModule { }

Step 5: Update html file

Now in view file, we will write code of input element with datepicker as like bellow:


<h1>angular material currency input mask - ItSolutionStuff.Com</h1>

<mat-form-field class="example-full-width">


<input matInput currencyMask placeholder="Ex. 120.00" value="">


Now we are ready to run our example, you can run by following command:

ng serve

you will see layout as bellow:

I hope it can help you...