Reputation: 944
I have an angular function that returns rounded numbers. If the number was rounded, it will add the "almost equal to" sign (≈) in front of the returned number. The problem is, it's not displayed as a html character, but as the characters ≈
instead. How is this fixed?
$scope.roundAprox = function(num) { //Returns almost equal to before rounded number if number was rounded
var numRounded = Math.round(num);
if (numRounded != num) //Has been rounded
return '≈' + numRounded;
else //Has not been rounded
return numRounded;
};
Upvotes: 0
Views: 281
Reputation: 944564
Use the ≈
character itself (instead of an HTML entity in a context that doesn't expect HTML).
Alternatively, use a JavaScript unicode escape sequence (\u2248
).
Upvotes: 2