'Empty spaces added around HTML text when using Angular interpolation
Any idea why an empty space is added before text in HTML when using interpolation in Angular?
Exemple in my Angular HTML template:
<div class="info-title">
{{ "Beds" }}
</div>
Result after ng serve:
<div _ngcontent-bej-c49="" class="info-title"> Beds </div>
You can see that some spaces are added before and after Beds.
Do you have any idea of what I could do to prevent those spaces from appearing?
This is an exemple and I'm aware that there's no need to use an interpolation here.
Solution 1:[1]
Remove the whitespace before and after the JavaScript.
<div class="info-title">{{ property.bedAmount > 1 ? "Beds" : "Bed" }}</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |