'How to ignore line breaks in Angular templates?

The code below will be rendered with starting and trailing whitespaces as you can see in the image. How do I get Angular to render the content without the starting and trailing whitespace?

If I remove the line breaks, the whitespaces will disappear, but sometimes I want to use line breaks to make the code more readable, but I never want it to be rendered. I'm using Angular 13 if that matters.

I tried to set preserveWhitespaces to false but nothing changed. And it should be set to false default anyway.

<h2>
    This is an example text. This is an example text. This is an example
    text. This is an example text. This is an example text.
</h2>

The output



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source