Show/hide an image inside a core-list conditionally

115 views
Skip to first unread message

Sachin Kumar

unread,
Sep 27, 2014, 8:58:36 AM9/27/14
to polym...@googlegroups.com
I am using a core-list on a section when data come I want to show/hide item image conditionally i.e. when data.image come then the image src will be {{data.image}} else image src should be default image.(data is the attribute here which is an array containing data)

I used template but it does not change i.e. either it will hide or show.

Please tell me the solution for this problem.

Rob Dodson

unread,
Sep 27, 2014, 11:12:30 AM9/27/14
to Sachin Kumar, polymer-dev
Could you post some sample code?

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/c50b4297-122a-4408-9e37-a38d6c98b759%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aleks Totic

unread,
Oct 1, 2014, 12:23:30 AM10/1/14
to polym...@googlegroups.com
This?

<template if="data.image != null">
  <img src="{{data.image}}">
</template>
<template if="data.image == null">
  <img src="loading.jpg">
</template>

Scott Miles

unread,
Oct 1, 2014, 1:18:24 AM10/1/14
to Aleks Totic, polymer-dev
How about:

<img src="{{data.image || 'loading.jpg'}}">

Follow Polymer on Google+: plus.google.com/107187849809354688692

---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages