Ion-img not rendering in RC.5


#1

Hi,

After update to RC.5 I can’t get ion-img to render my image until I scroll the view down a little.

Here is my ion-img:

<ion-img src="{{(banner | async)?.url}}" style="width: 100%; height: 160px;" cache="true"></ion-img>

Any help?

Thanks.


#2

ion-img should be used like this

<ion-img [src]="banner?.url"></ion-img>

And only inside of virtual scroll.


#3

Ohh, really? Only inside a virtual scroll?

Then ion-img should be part of virtual scroll docs, because it looks like a standalone component :frowning:


#4

I have the same issue. Can someone verify if this is a known bug ?


#5

Why would you limit to be used only under virtual scroll? Any specific reason?


#6

Its limited to virtual scroll because it’s tied to it.
ion-img is meant to work with virtual scroll, and provide more method that integrate with virtual scroll so we can more quickly update the image as the users scrolls.
This is not possible with just regular img tag, so we made our own.

It is not a bug, but a design decision we have made.


#7

If you allow ion-img to be outside the virtual scroll you can use to to introduce further optimizations outside the virtual scroll on a future version and more importantly, make it easier to use cause the API is transparent and not one off.


#8

I agree. ion-img is also useful outside of virtual scroll