Lost event listeners
See original GitHub issueHi,
first of all, thank you for porting the charts into angular’s world.
I’ve got issue, when data are append after a chart creation. I’m using Object.create() in my subscribe’s callback to re-draw the chart with new options, what causes the method from (chartSelect) isn’t called.
Am I doing wrong or is it a bug?
scrap of code for reference:
export class Component {
activityChartOptions: any;
constructor(private service: Service) {
this.activityChartOptions = require('./charts/activity.json');
}
// ...
private fetchStats() {
this.service.get().subscribe((result) => {
this.activityChartOptions = Object.create(this.activityChartOptions);
this.activityChartOptions.dataTable = result;
});
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Losing Event Listeners on Function Recall - javascript
I checked DevTools and the created elements prior to that lose the click event when I execute the function again.
Read more >Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >Javascript - How to list all active event listeners on a Web page
Javascript - How to list all active event listeners on a Web page, events defined by addEventListener or in an event attribute.
Read more >Element: focusout event - Web APIs | MDN
The focusout event fires when an element has lost focus, after the blur event. The two events differ in that focusout bubbles, while...
Read more >Event Handlers for DOM Event Listeners Lose the Context ...
Given that the event handler is an instance method, the reference to its object instance should be preserved. If the issue cannot be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

There is a bug when registering events on a loaded chart, I’ve created a pull request to fix it #31
HI again.
I took the code from your demo and modified the
app.component.tsa little to simplify and to simulate an API call. As I’ve described above listener stops working, when data are re-created.Cheers!