1
I’m using Routeparams in Angularjs
$routeProvider.when("/ReciboPagamentoCorretor/:NUMERO_RECIBO", {
templateUrl: "view/ReciboPagamentoCorretor.html",
controller: "ReciboPagamentoCorretorController"
})
but at the time of rootScope
$http.get(config.BaseUrl + "/auth.php").success(function(inf) {
if (typeof inf == "object") {
if (inf.nivel == 1 && $location.path() != "/ContratosCorretor" &&
$location.path() != "/NovoContratoCorretor" &&
$location.path()!= "/PagamentosCorretor" &&
$location.path() != "/ReciboPagamentoCorretor" &&
$location.path() != "/ContratosPendentesCorretor") {
$location.path("/ContratosCorretor")
}
}
})
He says that location.path() != "/ReciboPagamentoCorretor"
is true and won’t let me access the page /ReciboPagamentoCorretor
But, what is your goal? I don’t know why you mentioned the use of routeParams but are only using $Location. What is your goal and what is the current problem?
– celsomtrindade
That verification
location.path() != "/ReciboPagamentoCorretor"
istrue
, for the$location.path()
that must be coming according to your route, must be something:"/ReciboPagamentoCorretor/1"
, where number 1 would be the:NUMERO_RECIBO
of route. So this"/ReciboPagamentoCorretor/1"
is different from that"/ReciboPagamentoCorretor"
. What you can try to do to solve this is a startWith (starts with) or some regular expression.– Fernando Leal