ngRoute not properly destructed upon $destroy of $rootScope #8295
Description
In our application we use angular for all popup windows, a popup window has multlple pages (wizard-like) and are controller by ngRoute.
As the popup closes, we implicitly destruct the $rootScope:
angular.element('#modal-content').scope().$root.$destroy();
However, ngRoute still locks down the browser's hash location, forcing all window.location.hash changes to the $routeProvider.otherwise() setting.
For example, configuration:
$routeProvider
.when('/', {
...
})
.when('/page2', {
...
})
.otherwise({
redirectTo: '/'
});
After closing the popup and destroying the rootScope that configured the route, changes to window.location.hash, get reverted to '#/'.
Stepping through the code, it seems that the "$browser.startPoller" function (https://code.angularjs.org/1.2.20/angular.js line: 4431) is never properly stopped/cleared, which in turn triggers ngRoute on every hash change.