i'm trying to use ngRoute to config my routes on my app but for some reason, it still not working. i've searched a lot and seems my code is ok. i'm gonna show how i'm doing it:
my a.href:
<a href="#/bancodedados">
my config route:
academico.config(function($routeProvider){
var home = {
controller : "home",
templateUrl : "js/plugins/angular/views/home.html"
}
var bancodedados = {
controller : "bancodedados",
templateUrl : "js/plugins/angular/views/bancodedados.html"
}
$routeProvider
.when("/", home)
.when("/bancodedados", bancodedados);
});
but for some reason the app redirect me to http://localhost/joli/#!/#%2Fbancodedados
and still on the same views.
This is often because of upgrading angular to version 1.6 which changes the default hash prefix to !
whereas it used to be ''
(the empty string). You can read more on this here and here.
Potential Fix 1: Change your links to use #!
(hashbang) as follows:
<a href="#!/bancodedados">
Potential Fix 2: reset the hash prefix back to the empty string by injecting $locationProvider
into your config block and then setting the hash prefix as follows:
academico.config(function($routeProvider, $locationProvider){
$locationProvider.hashPrefix('');
// The rest of your config block...
});