Hey I have create a demo to demonstrate a problem in a large scale.
Update: I have updated the demo, the problem is with ngIf!!
This the demo: https://stackblitz.com/edit/angular-ivy-bac4pe?file=src%2Fapp%2Flist%2Flist.component.ts
And this is the problem: we used directives not only as extension for behavior of components , but also as external apis for components. We have a list component which suppose to show the current items of the list with pagination. We have a paginator directive which his job is to expose Pagination Api for the component. We have a pagination Service which perform the actual pagination(paginate method) according to data and page size.
I have occurred a very weird behavior: There is a setInterval which act like a polling - update data every 5 seconds. When I try to update current list of items through directive->Service-> The items doesn't get updated, even though I have called markforCheck ,because I working on Push Strategy to increase performance. I don't want to call detectChanges because it is a bad practice.
When I try to update current list of items through Service->Component with markForCheck everything works just fine.
I will be happy if someone can explain this phenomena in detailed why this happens and how to solve this issue.
if (!data.isFirstChange) {withif (!data.firstChange) {?