Issue description
I have an application with several components, loaded via <router-outlet>
. Each of these components includes the map, which means each time a link is clicked, a new google map in created in the <router-outlet>
(but there is only 1 map at a time in the application).
It seems that each time a map is created, it adds lots of events listener on the DOM elements, but do not removes them when it is destroyed. Then, after several links followed, the application is very slow, particularly when typing in form inputs.
I'm not sure if it's a bug, or if i should use only one map in the application, and update its values depending on the component I open/close.
Current behavior
Application/form inputs typing is very slow, events listeners created by the map are not removed.
Expected/desired behavior
Events listeners should be removed, and the application should not be slowed.
angular2 & angular2-google-maps version
Angular 2 rc5 & angular2-google-maps 0.12.2
Events listeners should be removed, and the application should not be slowed.
Yeah, I think we removed some of the event listeners but I'm not sure if we have removed all listeners.
2) We should run google maps calls outside of the Angular Zone, as we subscribe to google maps events and run it in the zone already. This should also give performance improvements.
I have similar problem like @gnujeremie. When I create map and then display some Polylines, everything goes well ( I can switch between display of different polylines without any troubles) until I go to some page where is no map component. When I return to page with map, page and map is working very slow.
When I don't display any polylines, problem dissapears.
Temporary solution for me could be make this element global in visiblity hidden - so it will be created only once - but that's not ideal...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Yeah, I think we removed some of the event listeners but I'm not sure if we have removed all listeners.
2) We should run google maps calls outside of the Angular Zone, as we subscribe to google maps events and run it in the zone already. This should also give performance improvements.