I have a datepicker which repeatedly triggers change detection whenever ngModel is being used (not even ngModelChange, just the input). This happens on ChangeDetectionStrategy.OnPush or Default.
This component is in a secondary project if that changes anything.
- Angular version: 19
- Primeng version: 19
Edit to clarify: the output isn't used. Here is what it looks like.
<p-datepicker [ngModel]="date" />
I have a datepicker which repeatedly triggers change detection whenever ngModel is being used (not even ngModelChange, just the input). This happens on ChangeDetectionStrategy.OnPush or Default.
This component is in a secondary project if that changes anything.
- Angular version: 19
- Primeng version: 19
Edit to clarify: the output isn't used. Here is what it looks like.
<p-datepicker [ngModel]="date" />
- What do you mean by "datepicker which repeatedly triggers change detection". Like the cd runs all the time even when user is not active in the UI or it runs when you are changing the date? – Daniel Macak Commented Mar 17 at 19:50
- @Daniel Macak change detection is constantly triggered and causes the app to freeze up – Joseph Coulter Commented Mar 17 at 19:54
- Can you put together a working example so we can have a look? – Daniel Macak Commented Mar 18 at 6:44
1 Answer
Reset to default 0The repeated change detection with ngModel is a common characteristic of two-way binding with input elements. To reduce it, focus on Using ngModelChange when possible and also try Debouncing method on the date picker selection events.