ove
ove

Reputation: 3202

NgMask - To support 2 decimal places

Currently trying to integrate NgMask below.

Does anyone knows if it supports decimal pattern up to 2 decimal places? eg. 22.00 or 1893.75

I like to limit entry up to 2 decimal places. Any regular expression that support this?

http://candreoliveira.github.io/bower_components/angular-mask/examples/index.html#/

Upvotes: 3

Views: 3117

Answers (2)

Shweta Kumari
Shweta Kumari

Reputation: 19

mask="0*.00" would work if you want to allow numbers with any length before decimal and only two digits after decimal. eg: 23.22, 123452.65 using ng-mask.

Upvotes: 1

swestner
swestner

Reputation: 1917

This regular expression should work

^\d+\.\d{2}$

This will require at least one digit before the decimal, and 2 digits after.

Upvotes: 1

Related Questions