"listener method not defined" when using an annotated listener in the template content of another element

561 views
Skip to first unread message

andrei...@gmail.com

unread,
Mar 4, 2016, 4:17:44 AM3/4/16
to Polymer
I have an element that contains a dom-repeat, but the template for the dom-repeat is from the element's Light DOM. (hope I've used the terms correctly)

<dom-module id="my-list">
 
<template>
   
<content></content>
   
<template id="repeater" is="dom-repeat" items="items">
   
</template>
 
</template>
</dom-module>

To initialize the dom-repeat I do this:

ready: function() {
 
this.$.repeater.templatize(Polymer.dom(this).querySelector("template"));
}


And to use my-list, from another element, I have this:

<my-list>
 
<template>
   
<paper-item on-click="_clicked">Click Me</paper-item>
 
</template>
</my-list>


But when I click the item, I get the following error:

[my-list::_createEventHandler]: listener method `_clicked` not defined

For some reason, it is looking for the method in the my-list element, not in the element that it's part of.

iron-list doesn't have this issue. Any ideas how I can solve this?

abho...@qualogy.com

unread,
Aug 16, 2017, 2:03:52 PM8/16/17
to Polymer, andrei...@gmail.com
instead of on-click attribute try on-tap ="_clicked"

Op vrijdag 4 maart 2016 06:17:44 UTC-3 schreef andrei...@gmail.com:
Reply all
Reply to author
Forward
0 new messages