When I run this, I get a syntax error. The problem is that the array is using object syntax. Remove the "card:" before each of the objects in the array, and it works fine for me:
http://jsbin.com/nugabi/1/edit?html,console,output Cheers, Arthur On Thu, Dec 18, 2014 at 12:25 AM, <[email protected]> wrote: > > Hello, i am having some issues with the following code.(just for test > purposes) > > <polymer-element name="card-board"> > <template> > <template repeat="{{card, cardIndex in cardArr}}"> > test {{cardIndex}}, <!-- output: test 1, test 2, --> > <card-item index="{{cardIndex}}" > indexedName="{{getCardIndexedName(card,cardIndex)}}"></card-item> > </template> > </template> > <script> > (function () { > > Polymer("card-board", { > cardArr: [ > card: { > name: "test" > }, > card: { > name: "test" > } > ], > > getCardIndexedName: function (card,index) { > //index is undefined.. > return card.name + index; > } > > }); > > })(); > </script> > </polymer-element> > > I am trying to send cardIndex as function parameter to the > getCardIndexedName function. for some reason it is undefined within the > function. > > point worth mentioning is that the "card-item" index attribute does recive > the cardIndex value. > > any ideas why? > > thanks. > > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/polymer-dev/0b3942c3-14b5-46c4-aa6a-74b7af738b2a%40googlegroups.com > <https://groups.google.com/d/msgid/polymer-dev/0b3942c3-14b5-46c4-aa6a-74b7af738b2a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/CADSbU_yXicbOLzn2Tbn-0uyyd5U%3Dd2bBVLTAxYhZvoDz1kAsjA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
