-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Description
In a SPA sometimes you bootstrap an Angular application then upon browser navigation you have to destroy the current application and bootstrap a new Angular application. All in the sampe page.
In this line, angular register a listener for the "popstate" and "hashchange" event using addEventListener:
However, after I destroyed the original application angular never call removeEventListener. Thus when I bootstrap the second application in my SPA the browser fires the new listeners for the "popstate" and "haschange" events plus the original ones.
The number of listeners keeps increasing if I keep navigating back and ford between this applications.
Desired result:
Remove "popstate" and "hashchange" events thru removeEnvetListener when the application is destroyed.