Skip to content

Commit

Permalink
Bind collection-repeat resize on view enter/leave
Browse files Browse the repository at this point in the history
  • Loading branch information
stianjensen committed Jan 19, 2015
1 parent 6a2be56 commit ee48cbd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/angular/directive/collectionRepeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,13 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
}

scrollCtrl.$element.on('scroll.resize', rerenderOnResize);
ionic.on('resize', rerenderOnResize, window);
$scope.$on('$ionicView.enter', function() {
ionic.on('resize', rerenderOnResize, window);
});
$scope.$on('$ionicView.leave', function() {
ionic.off('resize', rerenderOnResize, window);
});

var deregisterViewListener;
if (navViewCtrl) {
deregisterViewListener = navViewCtrl.scope.$on('$ionicView.afterEnter', viewEnter);
Expand All @@ -270,7 +276,6 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
$scope.$on('$destroy', function() {
collectionRepeatManager.destroy();
dataSource.destroy();
ionic.off('resize', rerenderOnResize, window);
(deregisterViewListener || angular.noop)();
});
}
Expand Down

0 comments on commit ee48cbd

Please sign in to comment.