Observe associative array

61 views
Skip to first unread message

silver...@gmail.com

unread,
Jul 29, 2014, 4:07:31 PM7/29/14
to polym...@googlegroups.com
Hi,

Can an associative array be observed with Polymer?

E.g.

 selected = {};
 selected["keyOne"] = {};
 selected["keyOne"].name= "ONE";


Kr,
Techar

Message has been deleted

silver...@gmail.com

unread,
Jul 29, 2014, 6:21:39 PM7/29/14
to polym...@googlegroups.com, silver...@gmail.com
I've tried binding to it but it didn't work.

Arthur Evans

unread,
Jul 29, 2014, 6:32:04 PM7/29/14
to silver...@gmail.com, polymer-dev
Are you thinking of data binding or the observe block?

You can bind to the objects in the array using array notation:

    {{selected[foo]}}

This should update when selected, foo, or the value at selected[foo] changes.

If you want to iterate over the items in an Object / associative array, it's a little trickier. 


Can you clarify what you tried and what you wanted it to do?




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/8925ad52-0898-4372-b11f-0d1d33b0791c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages