Closed jdmarsh closed 7 years ago
Inside the directive there is this section of code:
angular.element(window).on('resize', function(){ $timeout(function(){ $scope.$apply(); }); });
This adds an event listener onto the window object every time the directive scope is created. If you have an application with multiple tables over multiple pages then the event listeners soon start adding up.
Suggest doing the following or similar:
var onResizeCallback = function(){ $timeout(function(){ $scope.$apply(); }); }; angular.element(window).on('resize', onResizeCallback); $scope.$on('$destroy', function() { angular.element(window).off('resize', onResizeCallback); });
Inside the directive there is this section of code:
This adds an event listener onto the window object every time the directive scope is created. If you have an application with multiple tables over multiple pages then the event listeners soon start adding up.
Suggest doing the following or similar: