airfranceklm / ng-lazy-image

Angular directive for loading responsive image when container (which is preventing reflow) is in viewport.
http://afklm.github.io/ng-lazy-image/
MIT License
351 stars 64 forks source link

Unloaded images on page load after directive destroyed #70

Closed thisispaul closed 1 year ago

thisispaul commented 7 years ago

I'm experiencing an issue where I have a lot of images inside a ng-repeat.

When I change pages the directives are destroyed which then calls this the _onResize function (https://github.com/afklm/ng-lazy-image/blob/master/src/lazy-image.directive.js#L302).

After this _checkIfNewImage is determining it is a new image (for images that havent been shown yet it seems) and loading them.

This is causing me a problem because it is calling a lot of images (hundreds) and I would much rather it did not. Removing the destroy listener fixes this but obviouly it is there for a reason?

Any help on this is appreciated.