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

Alt value not set with imgAttrs #51

Closed bouwaccount closed 8 years ago

bouwaccount commented 8 years ago

I am trying to set the alt attribute on the image via imgAttrs option. But the alt attribute, though it is added, remains empty. If I try it with title it does set it correct.

The code: <div afkl-lazy-image="/productimages/{{product.brand.brandNameUrlFriendly + '-' + product.variantId + '-' + product.primaryPictureId}}.jpg?height=329" afkl-lazy-image-options="{'imgAttrs': [{'alt':'{{product.brand.brandName + '' + product.variantName}}' }]}" class="afkl-lazy-wrapper afkl-img-ratio-1-1 asp-product--img_legacycorrect"></div>

Produces: <div afkl-lazy-image="/productimages/off-white-omlb002s161120360210-29962-28316.jpg?height=329" afkl-lazy-image-options="{'imgAttrs': [{'alt':'Off WhiteOMLB002S161120360210' }]}" class="afkl-lazy-wrapper afkl-img-ratio-1-1 asp-product--img_legacycorrect" afkl-lazy-image-loaded="done"><img alt="" class="afkl-lazy-image" src="/productimages/off-white-omlb002s161120360210-29962-28316.jpg?height=329"></div>

The alt attribute is left empty.

If I try it with the title attribute: <div afkl-lazy-image="/productimages/{{product.brand.brandNameUrlFriendly + '-' + product.variantId + '-' + product.primaryPictureId}}.jpg?height=329" afkl-lazy-image-options="{'imgAttrs': [{'title':'{{product.brand.brandName + '' + product.variantName}}' }]}" class="afkl-lazy-wrapper afkl-img-ratio-1-1 asp-product--img_legacycorrect"></div>

Produces: <div afkl-lazy-image="/productimages/off-white-omlb002s161120360210-29962-28316.jpg?height=329" afkl-lazy-image-options="{'imgAttrs': [{'title':'Off WhiteOMLB002S161120360210' }]}" class="afkl-lazy-wrapper afkl-img-ratio-1-1 asp-product--img_legacycorrect" afkl-lazy-image-loaded="done"><img alt="" title="Off WhiteOMLB002S161120360210" class="afkl-lazy-image" src="/productimages/off-white-omlb002s161120360210-29962-28316.jpg?height=329"></div>

The title attribute is correct, but teher is also an alt but still empty.

Am I missing something here? Thanks for the help.

SquadraCorse commented 8 years ago

nope, my bad. I did set alt still with other setup. Will change that.

SquadraCorse commented 8 years ago

you can now use version 0.3.0 thanks for feedback!

bouwaccount commented 8 years ago

It works! Thanks for the quick response.