How to show two continuous spaces in Angular?
Bind to DOM property innerHTML
instead of DOM property textContent
(which is what {{}}
binds to):
<span [innerHTML]="text"></span>
text = "a b";
I believe you're getting this because of the nature of html stripping spaces.
You could perhaps use the white-space: pre
css property on whatever element you are rendering that text.
function MyCtrl($scope) {
$scope.text = 'a b';
}
...
<p style="white-space: pre">{{text}}</p>
I don't know alot about your application, but perhaps this will suffice.
Demo
use ' '
instead of ' '
in template.