Have an equality operator in angularJS that is not returning as I should.
example:
The value that comes from the object "data.valuea" is 50.
Have the value that comes from the object "data.valueb" is 200
<p ng-show="{{data.valuea >= data.valueb}}" class="ng-hide premioprogress">OK</p>
<p ng-show="{{data.valuea < data.valueb}}" class="ng-hide premioprogress">Faltam: {{data.valueb - data.valuea}} pts</p>
Am I doing something wrong? Or would a more correct way to do this?
It's likely that the values are actually strings and not numbers, so JavaScript is doing a string comparison. One way to get around this is to put
parseInt()
on the scope and use it in your expression...JSFiddle