简体   繁体   中英

How to validate Infinity in angularjs?

Here I want to restrict if a variable is infinity.

         if(!isNaN(response.MonthlyPayment) && !isFinite(response.MonthlyPayment)){
          //do here
         }

Here the infinity is not validating.

You can directly check like this

if(!isNaN(response.MonthlyPayment) && response.MonthlyPayment != Infinity) {
    //do here
}

You can go with this.

response.MonthlyPayment != Infinity

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM