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

Some images are not loaded when changing routes #44

Closed smnbbrv closed 7 years ago

smnbbrv commented 8 years ago

Hello again guys,

when I reload the page / switch between routes (using ui-router) _onViewChange for the objects contained by $window looks to be called in a wrong time because the height it calculates is much too big.

If I simply wrap _onViewChange content with a simple $timeout (or setTimeout 0ms) it seems to be fixed.

Is there another way to fix this behavior? Maybe I do something wrong? The problem is that some images are not loaded in this case although the offset property I specify is 2 times bigger than images size.

If you need more data just let me know.

Thanks!

smnbbrv commented 8 years ago

By the way it happens on page reload as well

SquadraCorse commented 8 years ago

0.2.4 :) Thanks Simon

smnbbrv commented 8 years ago

@SquadraCorse this one is not covered by my previous pull request. Maybe I understand wrong and it is going to be fixed on 0.2.4?

I fixed it on my fork: https://github.com/smnbbrv/ng-lazy-image/commit/61a7f0c225e153772d53060da8da0bdd1f904ee3 but didn't make a pull request yet. Should I?

barinali commented 7 years ago

@smnbbrv as far as I can see, smnbbrv@61a7f0c is merged. I guess we can close this issue.

By the way, I've opened a pull request which I replaced debounce with throttle in. You may take a look at it.