Srik
Srik

Reputation: 2381

Capture custom event at dom-bind

I am trying to capture custom-event at app level (dom-bind). I tried to capture the event in below two methods and both did not work.

1.

<template id="app" is="dom-bind" on-my-custom-event="handleEvent">

2.

app.addEventListener('my-custom-event', function(e){});

Plunker with demonstration: http://plnkr.co/edit/a5Ycs2p4fDaVZPqMNj2z

Upvotes: 3

Views: 83

Answers (1)

Neil John Ramal
Neil John Ramal

Reputation: 3734

No, you can't catch events emitted by a template element's children since the element's content is static. It is only when the template's content is stamped in the DOM (that is, outside of the template element) that the events will/can be emitted.

Upvotes: 1

Related Questions