$ionicScrollDelegate.resize();

I have a large div which is hidden using ng-hide.

After the div gets shown (following a model update), Ionic doesn’t update its scrolling area immediately, it often takes a few seconds.

So, I’ve had to manually call $ionicScrollDelegate.resize(); in this event. But, simply calling $ionicScrollDelegate.resize(); alone often doesn’t work (presumably because it’s being called before the view has been updated).

$timeout(function () { $ionicScrollDelegate.resize(); }); seems to work sometimes, but not always…

This solution seems to always work: $timeout(function () { $ionicScrollDelegate.resize(); }, 100); - however, this seems like a clunky hack that might NOT work on slower devices.

Is there a cleaner, nicer way to do this?

Maybe this works:

replace the ng-show with ng-if --> add a custom directive directive, which does the resize for you --> put this directive on the element with ngIf

ngIf removes the element completely from the DOM, if the condition does not fit. So if it is readded --> the directive is called.