Read about preserving whitespaces in Angular: https://angular.io/api/core/Component#preserving-whitespace
But for some reason I can't preserve them in template using ngPreserveWhitespaces
Even when addidng preserveWhitespaces: true doesn't change a thing.
here's stackblitz example
https://stackblitz.com/edit/angular-gaal3c?file=src%2Fmain.ts
Am I doing something wrong?
If you inspect element that text and double click it you will see that the white spaces are not actually removed, as to why your not able to visibly see the spaces, is because of CSS.
white-space
normal (default)
Ways to stop the collapsing, you can set the white-space property to use any of the below styles where
Spaces and tabsis set topreserve(for example:pre)ts
stackblitz