How to use Paper-item in another item

35 views
Skip to first unread message

rhys.m....@gmail.com

unread,
Nov 24, 2016, 11:39:08 PM11/24/16
to Polymer
Hey!

If I had a similar list item to the Polymer Shop:

..and I wanted to use a paper-icon-item, would the idea be to put the paper-icon-item inside shop-list-item?

Thanks!

Daniel Llewellyn

unread,
Nov 27, 2016, 4:50:55 PM11/27/16
to rhys.m....@gmail.com, Polymer
The shop example is built in a way that shows a working example, but some of the elements are designed to work with only their siblings. That includes the shop-list and shop-list-item elements. Unfortunately it means you cannot modify much without hacking it about directly.

If you just want to replace the image on an item then the object which defines each item can include an `image` attribute. This attribute will be passed to shop-image which determines the image display. The attribute itself should be a single string with the URL to the image you want to display.

To create your own custom list and list-item elements which allow for composability you can attempt something like http://stackoverflow.com/questions/34645114/polymer-dom-repeat-binding-to-content/34751655#34751655 however I don't understand that method well enough to advise usage.

HTH,
Dan.

Daniel Llewellyn

unread,
Nov 28, 2016, 11:00:28 AM11/28/16
to rhys.m....@gmail.com, Polymer
On Sun, 27 Nov 2016 at 21:50 Daniel Llewellyn <dan...@bowlhat.net> wrote:
To create your own custom list and list-item elements which allow for composability you can attempt something like http://stackoverflow.com/questions/34645114/polymer-dom-repeat-binding-to-content/34751655#34751655 however I don't understand that method well enough to advise usage.
 
Following-up to myself, I've created a codepen which shows how to define a list and list-item element that allows composition of inner elements: http://codepen.io/diddledan/pen/bBrxZR

Dan.

rhys.m....@gmail.com

unread,
Nov 29, 2016, 1:23:42 AM11/29/16
to Polymer, rhys.m....@gmail.com
Thanks Dan! I got to that stage myself with the composition. It was more so that I wanted to use the exact paper-item-icon but as my own component, so I have just put it inside for now.
Reply all
Reply to author
Forward
0 new messages