Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Services/Provider config surviving app teardown #9877

Closed
randombk opened this issue Nov 3, 2014 · 2 comments
Closed

Services/Provider config surviving app teardown #9877

randombk opened this issue Nov 3, 2014 · 2 comments

Comments

@randombk
Copy link
Contributor

randombk commented Nov 3, 2014

I'm trying to chase down a very elusive bug, and I'm not sure exactly where it's occurring. Heres the setup:

The application is a game client, which is separated into two stages, both written as separate angularjs applications. The first stage is the login screen, and is comprised of a handful of pages, managed using ui-router. When the player logs in, the first stage creates a new module with the session information, asynchronously loads the second stage js from the server, unloads itself by removing the DOM element, and bootstraps the second stage, which is the actual game client. This is done with the following code:

setTimeout(function() {
    angular.element(document.getElementById("loginSide")).remove();
    $rootScope.$destroy();
    angular.bootstrap(document.getElementById("gameSide"), ['client.game']);
}, 0);

I put this in a setTimeout to get out of the $apply scope of the first stage. The $rootScope refers to the first stage. This second stage also uses ui-router. This mostly works, with one major exception: the state configuration from the first stage has somehow survived, and is being applied to the second stage. Specifically, $urlRouterProvider and $stateProvider configuration in stage 1 still affects stage 2.

I don't know if this is intended behaviour, a bug in angularjs, or a bug in ui-router, which is why I created an issue in both. I'm on angularjs version 1.3.0, and ui-router 0.2.11. Thanks

@randombk
Copy link
Contributor Author

randombk commented Nov 4, 2014

@randombk
Copy link
Contributor Author

randombk commented Nov 4, 2014

I located the root cause of this problem. It turned out to be something a bit different than what I had initially guessed, so I created a new issue for it (#9897).

@randombk randombk closed this as completed Nov 4, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant