-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on-change doesn't get triggered when change happens programmatically #484
Comments
This is unfortunately how a checkbox works, the Example jsbin without polymer: http://jsbin.com/bebevoyo/1/edit |
Thanks for the feedback @azakus |
No, Instead, you can do one of two things:
Example 1: <template id="t" bind>
<input type="checkbox" id="one" value="{{checkboxOneValue}}">
</template>
<script>
t.model = {checkboxOneValue: false};
// change
t.model.checkboxOneValue = true;
</script> Example 2: <polymer-element name="my-checkbox" attributes="checked">
<template>
<input type="checkbox" checked="{{checked}}">
</template>
<script>
Polymer('my-checkbox', {
checked: false
});
</script>
</polymer-element>
<my-checkbox checked="true"></my-checkbox> We used #2 for Polymer by making core-input, but both are valid uses of the databinding implementation in Polymer. |
A couple of other options are:
|
I've this my very first web components called grouped-checkbox. Everything works great when I click on checkboxes and change their value. But when I change checked status of checkboxes programmatically, my change listener is not being triggered.
I've created this bin to demonstrate the issue:
http://jsbin.com/dixewowa/1/edit
I've my change listener on the wrapper div to use one listener for all checkboxes.
Maybe this is the issue?
The text was updated successfully, but these errors were encountered: