compiler: cryptic error when the track expression is empty for the control flow @for #54763
Labels
area: compiler
Issues related to `ngc`, Angular's template compiler
bug
core: control flow
Issues related to the built-in control flow (@if, @for, @switch)
hotlist: error messages
state: has PR
Milestone
Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
No
Description
Writing the following in a template:
@for (item of items; track )
will result in the cryptic compilation error:For 17.2 and the previous template compilation pipeline we got a different, but equally cryptic error:
Instead, we should detect those situations earlier and report the same / similar error as missing
track
keyword.Interestingly the same applies to the language service where the described situation is not reported.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-vlsqkz?description=An%20angular-cli%20project%20based%20on%20@angular/animations,%20@angular/common,%20@angular/compiler,%20@angular/core,%20@angular/forms,%20@angular/platform-browser,%20@angular/platform-browser-dynamic,%20@angular/router,%20core-js,%20rxjs,%20tslib%20and%20zone.js&file=src%2Fmain.ts,package.json&template=node&title=Angular%20Starter
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version
)No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: