"I have a problem where i'm initialising a variable on the scope in a controller. Then it gets changed in another controller when a user logs in. This variable is used to control things such as the navigation bar and restricts access to parts of the site depending on the type of user, so its important that it holds its value. The problem with it is that the controller that initialises it, gets called again by angular some how and then resets the variable back to its initial value. 
I assume this is not the correct way of declaring and initialising global variables, well its not really global, so my question is what is the correct way and is there any good examples around that work with the current version of angular?"
Thank you for reaching out with your concern. I understand that you're experiencing an issue with a variable that's being initialized in a controller and then getting reset by Angular. It's important to handle global variables correctly in Angular applications to ensure that they maintain their value across different components and lifecycle hook
Thank you for reaching out with your question. I'm happy to help you resolve the issue you're experiencing with initializing a variable in an Angular controller.It's important to understand that Angular is a complex framework, and there are specific best practices to follow when working with variables in controllers