Before moving to a controller, I make a web service call to GET a request. The response from this request is stored in the variable $rootScope.userSesion
. I want this web service to run every time I switch to a different view without having to duplicate the code in each controller:
angularRoutingApp.run(function($rootScope, $http){
// This code runs every time the view is changed
$transitions.onStart({ }, trans => {
.
.
.
$rootScope.userSesion="gestionarUsuarios";
})
.
.
.
})
In the HTML view, I display the value of $rootScope.userSesion
. However, when I click on an element that should take me to a different state specified in the ui-sref attribute, nothing happens and I get redirected to another state ('gestionarUsuarios'). The href attribute is pointing to the URL of the current view.
https://i.sstatic.net/s9MYt.jpg
Clicking on the element should take me to the "manageUsers" state, but it's not working. Here is the code from my view:
<a class="columna_menu border_contenedor_seis" ui-sref="{{userSesion.estado}}">
<div class="welle welle_seis"></div>
I want to be able to navigate normally when clicking on the element to change the *ui-sref**.