Comments (5)
Your @for
doesn't use any element by default where the ngFor
directive did.
The equivalent of @for (part of parts; track part)
is <ng-container *ngFor="let part of parts">
which exhibits the same issue.
You're probably looking for something like:
@for (part of parts; track part) {
<span{{part}}</span>
}
from angular.
@JeanMeche, stackblitz includes the ng-container
with ngFor
too, but it is not adding any whitespace
from angular.
What you're seeing is related to the preserveWhitespace
option, it's better to keep it on.
To drop any whitespace, you can resort to the comment block trick.
@for (part of parts; track part) {<!--
-->{{part}}<!--
-->}
from angular.
Since, we ran migrator on our entire codebase, it is difficult to add comment block trick or span wrappers. Will check out the preserveWhitespace option
from angular.
So HTML doesn't care about whitespace between HTML elements, but it does in between text nodes. It'll collapse multiple spaces between text nodes into a single whitespace when rendered. So this is happening because the for loop is rendering over multiple text nodes.
The migration auto formatting isn't perfect and can't account for every use case. This seems to be a very rare one. So my suggestion is to just disable the auto formatting for targeted files with this sort of syntax. You'll likely still have some whitespace issues, but it may resolve this one. Detecting this kind of use case would be complicated and the amount of effort to address this rare use case would be high. So I'm going to close this for now since there's workarounds.
from angular.
Related Issues (20)
- adev: API should show the alias of inputs and outputs
- While migrations the - angular version 8 to 10 I am facing the issue HOT 1
- Error link reported by ag HOT 1
- Component under @defer can not find injected services - R3InjectorError(DeferBlock Injector) error. HOT 1
- Vulnerability in package: @angular/localize > fast-glob > micromatch > braces HOT 1
- list of complete pipes link does not work HOT 1
- Fixit: Land #55183 to fix `this.` in templates
- Inect not working in normal function HOT 1
- Hydration: detect common mismatch patterns and produce a better error message HOT 1
- requestAnimationFrame not work´s HOT 1
- requestAnimationFrame Angular issue HOT 1
- App shell pattern diagram broken
- We detected an application built with production configuration. Angular DevTools only supports development build. HOT 2
- Example for CanMatchFn does not exist. HOT 1
- Mark pure pipes dirty when a signal that they read changes HOT 2
- Libraries built with esbuild yield "ReferenceError: Cannot access '_c1' before initialization" HOT 7
- Hello World Project is not Downloading from website. HOT 1
- Signal Pipes HOT 1
- Pipes broken url HOT 2
- Track keyword comment in the new control flow leads to a broken link HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.