问题
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 = '●●';
Fiddle - http://jsfiddle.net/Lvc0u55v/8334/
回答1:
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 = '●●';
来源:https://stackoverflow.com/questions/38966750/rendering-special-characters-in-placeholder-of-input-text-box