0

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.

0

1 Answer 1

1

Remove the whitespace before and after the JavaScript.

<div class="info-title">{{ property.bedAmount > 1 ? "Beds" : "Bed" }}</div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.