Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polymer 1.0 custom events

Tags:

events

polymer

I was using this code on Polymer 0.5 but on Polymer 1.0 it's not working.

On child element:

this.fire('login-start', {
    username: this.username,
    password: this.password,
    me: this
});

On parent element (app-main.html):

<dom-module name="app-main" on-login-start="{{checkLogin}}">

And on app-main.js:

checkLogin: function() {
    alert("This is not working.");
}

How do I fire and catch custom events in Polymer 1.0?

like image 881
paphonb Avatar asked May 30 '15 09:05

paphonb


1 Answers

You should remove the double brackets ({{}}) from on-login-start.

<dom-module name="app-main" on-login-start="checkLogin">

Here is the documentation.

like image 167
altfuns Avatar answered Oct 22 '22 10:10

altfuns