Make negative number positive, but maintain the actual value
I'm going on a whim here, but I figured I'd ask for a check here.
I have an integer value that I use to determine how other elements on the page act, the actual value of the integer is important (whether negative or positive), however it actually displays a prefix hyphen when negative. desirable.
Is there a way to "hide" the hyphen without changing the actual value of the integer? Bearing in mind that the value is $watch
ed, so multiplying it by -1 is out of the question.
Template:
<p>{{ value }}</p>
Directive
scope.$watch('value', function()
{
if (scope.value > 0)
{
//do something
}
else
{
//do something else
}
});
Added code, not what I believe is really needed
+3
source to share