Funnelwebs
Posts: 3
Joined: Fri Dec 01, 2023 9:35 am

Showing a default image

Hi all

I have this: [src] item.avatar.fileurl

This works fine as long as an image has been set, is there a way I can change item.avatar.fileurl to show a default image if none has been set?
aantsypau
Posts: 26
Joined: Wed May 24, 2023 7:57 am

Re: Showing a default image

You can use construction like this item?.avatar?.fileurl || 'path to default image'
Funnelwebs
Posts: 3
Joined: Fri Dec 01, 2023 9:35 am

Re: Showing a default image

Thank you,

I eventually figured this out using this:
item.avatar ? item.avatar.fileurl : 'path to default image'

Return to “Issues”