In our angular application we have different states/pages. In one of them we have the angular grid. However we noticed an unwanted behavior of it when someone is switching fast between them.
The problem is that
if (scrollNs.scrollContInfo) scrollNs.scrollContInfo.$elm.off('scroll', scrollHandler);
is not removing the scrollHandler as it is not yet set... it is not yet set because the assignment of the event is happening in a timeout:
In our angular application we have different states/pages. In one of them we have the angular grid. However we noticed an unwanted behavior of it when someone is switching fast between them.
The problem is that
is not removing the scrollHandler as it is not yet set... it is not yet set because the assignment of the event is happening in a timeout:
This problem could be solved if the timeout would be assigned to a variable (like the infiniteScrollTimeout timeout):
and then also canceled when the scope is destroyed: