-
Notifications
You must be signed in to change notification settings - Fork 27k
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
The following code
@for (a of b; track method) {}
and having
method = (index, item) => { return index }
The method is actually not called.
It comes to a surprise because the language service will link properly and everything but it doesn't actually run the tracking method.
For someone who comes from an *ngFor, they will blindly switch this trackBy to track and things will start failing at runtime.
If this is the "norm" then maybe the documentation should be reflected that you have to call method($index, a), but this is not obvious
Please provide a link to a minimal reproduction of the bug
https://angular-e967ee.stackblitz.io
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 17.3.2
Node: 20.11.1
Package Manager: npm 8.5.5
OS: win32 x64
Angular: 17.3.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, google-maps, language-service, localize, material
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr
Package Version
@angular-devkit/architect 0.1703.2
@angular-devkit/build-angular 17.3.2
@angular-devkit/core 17.3.2
@angular-devkit/schematics 17.3.2
@schematics/angular 17.3.2
rxjs 7.8.1
typescript 5.2.2
zone.js 0.14.4
Anything else?
No response