Currently only arrays are supported. Object (and possibly Map) values should also be made iterable.
This was requested in the Polymer 0.5 codebase per https://github.com/Polymer/polymer-expressions/issues/11.
Yes, please, please please.
:+1:
+1
I'll add to that and suggest adding support for any iterable object (including generators and other user-defined iterables). I think I requested it in 0.5 few months ago.
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
Please use the "Subscribe" feature under notifications in the right pane instead of +1'ing this into oblivion; Then everyone avoids getting spammed with useless notification emails.
When iterating over key-value iterable should index represent the key or should there be a separate key property?
+1
A possible solution could be to internally convert all Iterable (Object, Array, Set, Map, Generator) to a Map.
I don't know how performant this solution is...
Does someone have a better way to do it?
Additionally:
If we want to support Set/Map (generally) Polymer needs a way to listen to changes made to them.
Polymer can't even listen to Array changes natively, element.push is required.
So Polymer has to implement Set/Map method also... as I stated in #2074.
+1
+1 I would love this.
+1
+1
status?
Is anyone from the polymer team actively working on this?
Otherwise I'll take a deeper look into this.
BIGGEST +1
This line states that the itemsproperty of dom-repeat is an array.
Therefore we need a more general type to cover all iterable objects.
@kevinpschaaf What do you think about an "Iterable" type?
Furthermore Polymer.Collection handles the given array interally @ line 348.
Thus Collection must support all Iterables.
Critical parts are here, this loop must also cover other iterables.
+1
I needed a solution for this so I wrote something. Since I don't know Polymer internals and did not want to work with a modified version anyway, I had to make do with what's there. I transform the Object into an array once and then propagate only the changes up and down. It does not handle key additions/removals and array splices but otherwise it's fully transparent. Maybe some of it is of some use here. Usage:
<my-objarray object="{{object}}" array="{{array}}"><my-objarray>
<template is="dom-repeat" items="{{array}}">[[item.key]]: [[item.value]]</template>
The code is on stackoverflow.
Any updates on this? : one of the biggest downside I've found on polymer right now
The new Firebase element does no longer support an array like collection AFAIK, this makes an iterable template for objects a lot more relevant again I hope.
A big blocking here, of course, because of Firebase element changes.
+1
+1
+1
+1
+1
+1
Does Polymer 2.0 help with this issue? Every time I start side-projects using Polymer I step into this problem.
+1
+1 This would be a really neat feature to have
+1
+1
Polymer 2.0 doesn't seem to have this functionality either? At least I cannot find it in the specs?
Are there any plans to implement this? Was hoping so much for Polymer 2.0 ...
https://www.polymer-project.org/2.0/docs/devguide/templates
+1
+1
same as #800 maybe close one
+1 seems like such a basic functionality
Are there any plans for this to come?
When will there be a fix for this nonsense?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
The new Firebase element does no longer support an array like collection AFAIK, this makes an iterable template for objects a lot more relevant again I hope.