Angular formatter line breaks in double-curly braces cause whitespaces
See original GitHub issuePrettier 1.15.2 Playground link
# Options (if any):
# none
Input:
<h2 class="modal-title">{{ error == null || error.title == null ? 'someLongString' : someOtherInterestingValue }}</h2>
Output:
<h2 class="modal-title">
{{
error == null || error.title == null
? "someLongString"
: someOtherInterestingValue
}}
</h2>
This adds a leading and a trailing whitespace within h2. This is a problem when checking the textContent of h2 within a unit test.
Expected behavior:
<h2 class="modal-title">
{{ error == null || error.title == null
? "someLongString"
: someOtherInterestingValue }}
</h2>
Adding <!-- display: block -->
before the h2 tag does not change anything.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How to remove spaces from double curly brackets in Angular ...
It seems Angular Docs itself is a bit inconsistent in using spaces around curly brackets, but I would like to normalize this for...
Read more >Expressions | Handlebars
Handlebars expressions are some contents enclosed by double curly braces {{}} . In the below template, firstname is a variable that is ...
Read more >CSS Basics: The Syntax That Matters & The Syntax That Doesn't
All CSS rulesets must have opening and closing curly braces: ... A line break is treated like any other white space in CSS,...
Read more >The Best Angular Examples - freeCodeCamp
Inside the double curly braces, a variable's value is mapped from the ... by any whitespace character, such as a space, tab, or...
Read more >angular 2 escape html
Angular Escape Html Curly Braces How to use double curly braces in the angular ... The sanitizer will leave safe HTML intact and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Your expected behavior would still create extra text nodes. Didn’t you mean something like this:
?
the same issue