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

TypeError: Cannot read property 'one' of undefined #49

Closed stephenycchang closed 8 years ago

stephenycchang commented 8 years ago

Randomly, I would get this error in my console.

TypeError: Cannot read property 'one' of undefined at _checkIfNewImage (lazy-image.js:459)

where it's referencing the 'img' variable.

However, the images are working fine. Should I just ignore the error?

SquadraCorse commented 8 years ago

never ignore errors, somewhere online?

stephenycchang commented 8 years ago

It seems like that on route change, the number of elements in view using the plugin would throw the error. However, when the elements load in, they're perfectly fine.

All I have related to this code is:

app.module('....', 'afkl.lazyImage')

A sample element div I'm using is:

Is there a requirement of how the src should be loaded in?

Thanks

fustic commented 8 years ago

Same for me. Started with 0.2.3 version

SquadraCorse commented 8 years ago

link?

rfanjul commented 8 years ago

We have the same problem all the time. www.joiz.ch

levuro commented 8 years ago

http://www.joiz.de/#!/news - check the console on our site

SquadraCorse commented 8 years ago

Thanks joiz, why did you go live with it ;) will try to debug!

SquadraCorse commented 8 years ago

revert to 0.2.2 the broadcast on destroy to be able to work for people hiding/toggle stuff with ng-if now sends broadcast which is working after new view is being made

SquadraCorse commented 8 years ago

joiz if you have dev mode of website can you try 0.3.1 Please be aware that alt is not set anymore with alt but imgAttr ['alt': 'foo'] as mentioned in readme. But i hope this will not generate issues for your case anymore.

bdairy commented 8 years ago

so the temp solution now is to revert to 0.2.2??,, Sorry I am new to that, can you tell me how to do that using bower?

stephenycchang commented 8 years ago

@bdairy You can specify the version in your bower.json file to "0.2.2" and run a bower install after that.

Such as : "ng-directive-lazy-image" : "0.2.2"

Here's a good read from SO

Although 0.3.1 fixed it for me as well.

rfanjul commented 8 years ago

@bdairy ok! let me try and I let you know! thanks!

rfanjul commented 8 years ago

Yes exactly I can confirm that it works properly. Thanks a lot guys!

SquadraCorse commented 8 years ago

thanks, and sorry :)