Studying the topeka app

76 views
Skip to first unread message

Carl Youngblood

unread,
Feb 13, 2015, 12:27:46 AM2/13/15
to polym...@googlegroups.com
I'm trying to learn polymer from the pros, so to speak, so I'm studying the topeka app. One of the first questions is about the template on index.html. I noticed that it uses is=auto-binding to make use of the {{}} variable binding features in Polymer. I see the variables user, categories and connected in the template. What I'm wondering is where these variables get set. I don't see any code that is attaching to this template and setting them so that they can be passed on to the specified child elements. Can somebody please explain better?

Thanks,
Carl

Eric Bidelman

unread,
Feb 13, 2015, 12:40:10 PM2/13/15
to Carl Youngblood, polym...@googlegroups.com
Hi Carl,

This is the same behavior as polymer elements. When a new variable is used in a binding it becomes a property on your element/auto binding template. In Topeka, having user="{{user}}" on both tags binds their `user` property together. In this case, the binding variable is also named `user` and that property gets added to the <template is="auto-bind">. Presumably one of those tags also initializes its `user` property, and two-way data binding picks it up and populates the other.

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/74f277b9-fb3c-44d7-8b12-9c949d246296%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carl Youngblood

unread,
Feb 13, 2015, 12:54:24 PM2/13/15
to Eric Bidelman, polym...@googlegroups.com
Great explanation, thanks Eric. At first I thought that parents could only pass variables onto their children and didn't realize that changes in the children also propagated backwards to their parents. Makes sense now.
Reply all
Reply to author
Forward
0 new messages