Closed barbhackk closed 7 years ago
Which angular version is using? if you fetch the latest Angular JS 1.6.0 version, you should downgrade angular version to 1.5.8. See #1379 .
I try this solution. Thanks a lot.
Sébastien
Hi,
Finally I did not need to downgrade Angular. I'm running on Angular 1.6.0. It is enough to replace the links href="#/blog" by "#!/blog" and it works for me.
Can customize it thanks to the method $locationProvider : https://docs.angularjs.org/api/ng/provider/$locationProvider
$locationProvider.hashPrefix('');
The default value for the prefix is '!', so #!/url
Thanks,
Sébastien
I had the same issue which caused problems for hours yesterday. Where did you place this location provider? And are you using #!/about now or without !
Hi,
Now, use #!/ link instead #/ link. Work fine for me.
If you want to use only #/ link, place this code $locationProvider.hashPrefix('');
like this :
angular
.module('webApp', ['ngAnimate', 'ngAria', 'ngCookies', 'ngMessages', 'ngResource', 'ngRoute', 'ngSanitize', 'ngTouch'])
.config(function ($routeProvider, $locationProvider) {
$routeProvider
.when('/blog', {
templateUrl: 'views/blog.html',
controller: 'BlogCtrl',
controllerAs: 'blog'
})
.otherwise({
redirectTo: '/'
});
$locationProvider.hashPrefix('');
});
Sébastien
^^ This solution is the simplest and works perfectly. Thanks
Hmmm, I tried to send a PR to fix this as suggested by Playntek but somehow it didn't work as expected. Advice welcome :thinking:
Look Developer Guide, Migrating from 1.5 to 1.6 for more information https://docs.angularjs.org/guide/migration#migrating-from-1-5-to-1-6
I resolved by 1.Upgrading Angularjs version to 1.5.8 . 2.By adding $locationProvider.hashPrefix(''); in app.js file.
Thanks a lot @sebast1. I had wasted an hour for this problem, checking my code. Thanks a lot!
Thank you @sebast1. You are a saviour.
Hi,
I started a new project using the generator Yeoman for Angular. When I used the command 'grunt serve' the webb app starting. When I click on the navigation (about...), I notice that the corrective page does not load and the URL contain '%2F' instead '/'. So my routing does not work.
Is it an Angular or Generator (Yo) problem? Do you have an idea ?
I'm on Macbook Pro, OS El Capitan.
Thx,
Sébastien (PNT)