Amila Iddamalgoda Amila Iddamalgoda - 1 year ago 79
AngularJS Question

Rendering special characters in placeholder of input text box

I need to show dots (●
) as the placeholder of the text input. But they are not rendering just showing the unicode in the placeholder. Please help me out

<input type="text" ng-model="inputText" placeholder="{{somePlaceholder}}" />

In the controller:

$scope.somePlaceholder = '&#9679;&#9679;';

Fiddle -

Answer Source

That's javaScript, you have to use \u escapes for Unicode characters.

$scope.somePlaceholder = '\u25cf\u25cf';

Or just write those dots literally (assuming the encoding of your script is declared properly by your web server).

$scope.somePlaceholder = '●●';