This works great. I'm able to visit that state which lazy loads home-module.ts, which in turn registers the components that are a part of home-module.ts. This all works as expected.
I then want the ability to de-register that very state, and reregister the same state.
If I now revisit the home.** state the module is not lazy loaded and its components aren't registered. I'm trying to understand what's going on here.
I have a feeling that when we deregister the state, something happens to that lazy loaded module - it's not unloaded because we cannot do that in JS. I'm guessing that the namespace (the module name) creates a pointer that references the original state name (home.**) and when we deregister the state, that pointer is broken. I'm out of ideas at this point.
Any help on this would be appreciated. Thanks in advance!
If you don't mind me asking, what's the use case for deregistering a state at runtime? That's something I've never actually seen done in the wild and I'd like to know more.
I'm using ocLazyLoad in combination with UI-Router to lazy load my modules on state transition.
This works great. I'm able to visit that state which lazy loads
home-module.ts
, which in turn registers the components that are a part ofhome-module.ts
. This all works as expected.I then want the ability to de-register that very state, and reregister the same state.
If I now revisit the
home.**
state the module is not lazy loaded and its components aren't registered. I'm trying to understand what's going on here.I have a feeling that when we deregister the state, something happens to that lazy loaded module - it's not unloaded because we cannot do that in JS. I'm guessing that the namespace (the module name) creates a pointer that references the original state name (
home.**
) and when we deregister the state, that pointer is broken. I'm out of ideas at this point.Any help on this would be appreciated. Thanks in advance!