0

How to allow on text input , numbers and one dot using Angular?

I have this on html :

  <input type="text"  ng-pattern="/^[0-9.]*$/" />

But I want to allow just one dot.

Any idea?

BrMe
  • 315
  • 2
  • 8
  • 22

1 Answers1

2

Seems like you want to allow decimal or integer numbers.

^[0-9]+(?:\.[0-9]+)?$
Avinash Raj
  • 172,303
  • 28
  • 230
  • 274