Within my application, I have a $rootScope variable in the .run() function that is used for basic HTTP requests. However, I run into an issue when I try to modify this variable within different controllers by changing the URL suffix and adding different headers.
The problem arises when any controller modifies the $rootScope variable, as it affects the variable's value globally. Despite attempting to create copies of the $rootScope variable in various services and controllers, the original variable still gets altered.
For instance:
Let's assume the initial URL stored in the $rootScope variable is:
When I navigate to the login page, I update the URL to:
by simply appending 'login' at the end. But, when I attempt to logout and change the URL to:
I unexpectedly end up with: