Mohammed Mohammed - 1 year ago 76
AngularJS Question

AngularJS - How to parseInt in angulrjs expresson

I have such type of condition:

<td ng-repeat="sal in name.salaries"
ng-if="name.avalue>sal.annual_value">
Value must be less than or equal to Balance Amount
</td>


Whats happening in real scenario is

For Eg.
name.value=1200 sal.annual_value=42

as its not parseInt thats why its considering
42 > 1200
.

How can I
parseInt()
in AngularJS expression?

Answer Source

I would use a scope function to make that verification:

{...}
scope.checkSalaries = function(avalue, annual_value) {
   return avalue > annual_value;
}
{...}

and in html:

<td ng-repeat="sal in name.salaries"
    ng-if="checkSalaries(name.avalue,sal.annual_value)">
       Value must be less than or equal to Balance Amount
</td>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download