How to limit the number of decimal digits in the input box of type number in Angularjs

Source: Internet
Author: User

When you do a project, you need to restrict the contents of the input box to enter only two decimal places.


First of all to limit the number can only be entered, this is very good implementation, using the following code can be

<span style= "FONT-SIZE:14PX;" > <input type= "number"  ng-model= "interest" name= "interest" required/></span>


Required: This input box is required

Type=number: Only integers can be entered


How do I allow two decimal places to be entered?

We need to use the Step property (step is the meaning of step)

    1. for now, step the browser is ie10+, Chrome and Opera browser.
The following small section contains step HTML code for the property:

<span style= "FONT-SIZE:14PX;" > <input type= "number" step= "0.01" ng-model= "interest" name= "interest" required/></span>

How to enter three decimal digits, this step=0.001, and so on


How to limit the number of decimal digits in the input box of type number in Angularjs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.