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

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -