Closed Opcyc-Ben closed 1 month ago
This is because the test()
function creates a new function instance every time it is invoked during change detection. This basically makes change detection run indefinitely. I'm closing the issue, because we can't do much about it.
The way to resolve it on your end would be to have a static filter function that has the logic for switch internally.
Just out of curiosity: How is one supposed to design a filter then, that depends on the loop variable of a surrounding @for? EDIT: oh god, I just pinged a random person on github -.-
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Code is truncated for conciseness. See Stackblitz for full example.
This code works as one would expect:
This code does not:
Example Stackblitz is attached. The important files to pay attention to are the demo component's .html and .ts files. Everything else is unchanged.
Reproduction
StackBlitz link: Link Steps to reproduce:
[matDatepickerFilter]="test()"
. (Mind the parentheses)Expected Behavior
A working date picker. Clicking dates should select the date.
Actual Behavior
The date picker opens and renders, however, all dates are unresponsive. Clicking dates does nothing.
Environment
Angular ('ng version' output):
Angular CLI: 17.0.8 Node: 21.5.0 (Unsupported) Package Manager: npm 10.2.4 OS: win32 x64
Angular: 17.0.8 ... animations, cli, common, compiler, compiler-cli, core, forms ... localize, platform-browser, platform-browser-dynamic ... platform-server, router
Package Version
@angular-devkit/architect 0.1700.8 @angular-devkit/build-angular 17.0.8 @angular-devkit/core 17.0.8 @angular-devkit/schematics 17.0.8 @angular/cdk 17.0.4 @angular/material-moment-adapter 17.0.4 @ngtools/webpack 17.0.8 @schematics/angular 17.0.8 rxjs 7.8.1 typescript 5.2.2 zone.js 0.14.2
Warning: The current version of Node (21.5.0) is not supported by Angular.
Included above
Microsoft Edge for Business Version 126.0.2592.87 (Official build) (64-bit)
Edition Windows 10 Pro Version 22H2 Installed on 13/06/2020 OS build 19045.4529 Experience Windows Feature Experience Pack 1000.19058.1000.0