javascript - Convert numeric string to number in angular 2 -


i want compare angular 2 expressions. got array of data in numeric string database need convert number before give condition ngclass styling. how can convert type. idea?

  <td [ngclass]= "{'positive': gbh.last > 0, 'negative': gbh.last < 0}"> {{gbh.last}} </td> 

as far know, can not convert numeric string number inside angular expression.

the best practice define method in controller solve expression using 'parseint'

  function ispositive (x: string, y: number): boolean {       return (parseint(x, 10) < y);   } 

Comments

Popular posts from this blog

4x4 Matrix in Python -

python - String indices must be integers and while issue -

wso2is - WSO2 IS 5.0.0 SP1 After restart there is authentication error -