javascript - Polymer 1.0 Paper Radio Group Conditions -


i can't function trigger when button selected in polymer 1.0. when, example, "medium" selected, alert should pop up. new polymer , trying head around it.

<dom-module id="my-app">     <template>       <paper-radio-group selected="{{selection}}">         <paper-radio-button name="small" label="small"></paper-radio-button>         <paper-radio-button name="medium" label="medium">meduim</paper-radio-button>         <paper-radio-button name="large" label="large"></paper-radio-button>       </paper-radio-group>     </template>     <script>       polymer({         is: "my-app",         ready: function () {           if (this.selection === "medium") {             alert("medium");           }         }        });     </script>   </dom-module> 

essentially, you'll need wire bindings notify when selection changes. first, set selection property, define observer it. observer callback called whenever property value changes.

... polymer({   is: "my-app",   properties: {     selection: {       type: string,       observer: "selectionchanged"     }   },   selectionchanged: function (newval, oldval) {     if (newval === "medium") {       alert("medium");     }   } }); 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -