Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

Ensure only our resize is unbound on #276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/components/DataTableDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ export function DataTableDirective($window, $timeout, $parse){
ctrl.adjustColumns();
};

$window.addEventListener('resize',
throttle(() => {
$timeout(resize);
}));
var throttledResize = throttle(() => {
$timeout(resize);
});

angular.element($window).on('resize', throttledResize);

// When an item is hidden for example
// in a tab with display none, the height
Expand All @@ -124,7 +125,7 @@ export function DataTableDirective($window, $timeout, $parse){

// prevent memory leaks
$scope.$on('$destroy', () => {
angular.element($window).off('resize');
angular.element($window).off('resize', throttledResize);
});
}
};
Expand Down