RevillWeb / angular-preload-image

A simple AngularJS module to make it easy to pre-load images.
MIT License
70 stars 29 forks source link

"terminal" property of preloadImage breaks other directives #1

Open mcwebb opened 9 years ago

mcwebb commented 9 years ago

Hi there, I really like the directive thanks very much for your work. I just thought I should report that the terminal property of the preloadImage directive can break other directives really badly. Both "ui-sref" from the ui.router module and "on-touch" from Ionic are broken when "preload-image" is applied to the same element. I'm sure there's a reason you've included this property, however I've removed it in this fork and have had no adverse effects so far.

RevillWeb commented 9 years ago

Hi mcwebb, thank you for contacting me. The reason for using terminal is to overwrite the ng-src directive so that the preload image directive can take control of the element src attribute. If you remove terminal you probably wont see any diverse affects but it wont be pre-loading your images. Have you tried a really, really big image? You will probably get the waterfall effect. I will take a look at your fork and get back to you, thanks again.

mcwebb commented 9 years ago

Ah, okay that makes sense. This is potentially not an issue that is worth fixing since there are many simple workarounds e.g. applying the 3rd-party directives to a container element rather than the <img /> itself. However as far as I understand terminal: true could be avoided by using a different attribute to define the image url i.e. rather than ng-src="file.jpg" use real-image="file.jpg". I'll test this in my fork but since this is an edge-case and would introduce major breaking changes feel free to disregard.

Cheers

ghost commented 9 years ago

Hello, Thank you very much for you work. Did notice that ng-style does not work with directive either, and mcwebb's solution did fix it.