I am developing a system where depending on the user level it is redirected to a page
.run(function($rootScope, $location, $http, config) {
$rootScope.$on('$locationChangeStart', function(event) {
if ($location.path() != "/Login") {
$http.get(config.BaseUrl + "/auth.php").success(function(inf) {
if (typeof inf == "object") {
if (inf.nivel > 0) {
$location.path("/ContratosCorretor") ;
}
That is, if the user level is greater than 0, he is a broker and will be redirected to his page, but he will be able to access one more page
$routeProvider.when("/NovoContratoCorretor", {
templateUrl: "view/NovoContratoCorretor.html",
controller: "NovoContratoCorretor",
})
So that's my $ rootscope and it will always be redirected to /ContratosCorretor
. Does anyone have any solutions to this problem?