Event Listeners in Polymer


Event handling is one of the main activities, where events refer to actions to be performed on any UI elements.

For Example, clicking on the Signup button, selecting or deselecting items using a checkbox or radio button(In any Quiz), clicking on the any google link, select an item from the drop down Menu bar, etc.

< button  on-click="handleClick">Click< /button>
----------------------------------------------------------------
\\Event handler can be defined inside the custom element's class
class ClassName extends PolymerEle {
static get is() { return 'template_name'; }
handleClick(){
}
}
\\ClassName is the name of custom element class
\\template-name is a custom element name

We can use the standard CustomEvent constructor and dispatch method to fire a custom event from the host element

\\Syntax
this.dispatchEvent(new CustomEvent('logevent'));





Visit :


Discussion



* You must be logged in to add comment.