Binding polymer-ui-toggle-button to a boolean value

348 views
Skip to first unread message

Marcin Warpechowski

unread,
Feb 25, 2014, 5:27:17 AM2/25/14
to polym...@googlegroups.com
I have problem binding polymer-ui-toggle-button to a boolean value and it looks like a bug to me. The toggle receives the initial value from my model but does not update the model after a change. Also, two toggles don't reflect each other changes. Any ideas?

<polymer-ui-toggle-button value="{{isThisFantasy}}"></polymer-ui-toggle-button>
t2.model = {
    isThisFantasy: true
};


The above fiddle also tries binding to a regular HTML checkbox input. It fails, probably because value gets converted to string. Is there a way to bind a boolean to a checkbox input?

br
Marcin

Marcin Warpechowski

unread,
Feb 25, 2014, 5:33:32 AM2/25/14
to polym...@googlegroups.com
I have a solution for the regular HTML checkbox input. Use the "checked" attribute:

<input type="checkbox" checked="{{isThisReal}}">


But I still don't know how to achieve the same with polymer-ui-toggle-button

Steve Orvell

unread,
Feb 25, 2014, 10:17:40 AM2/25/14
to Marcin Warpechowski, polym...@googlegroups.com
You'll need to wait to stamp the template until the <polymer-ui-toggle-button> definition has been registered. Here's your example, updated:



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/a4364ce2-3183-44dd-abb5-f36e71adf22a%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Marcin Warpechowski

unread,
Feb 26, 2014, 7:29:54 AM2/26/14
to polym...@googlegroups.com
Thank you, that indeed was the solution to this problem and a couple of others.


On Tuesday, February 25, 2014 11:27:17 AM UTC+1, Marcin Warpechowski wrote:
Reply all
Reply to author
Forward
0 new messages