ngRoute html5Mode(true) refresh

127 views
Skip to first unread message

Polokh Andrey

unread,
Mar 6, 2015, 6:43:44 AM3/6/15
to ang...@googlegroups.com
Hello, 

I configured my routeProvider like this:

        $routeProvider
               
// route for the home page
               
.when('/', {
                    templateUrl
: 'pages/home.html',
                    controller
: 'mainController'
               
})
               
// route for the about page
               
.when('/about', {
                    templateUrl
: 'pages/about.html',
                    controller
: 'aboutController'
               
})
               
// route for the contact page
               
.when('/contact', {
                    templateUrl
: 'pages/contact.html',
                    controller
: 'contactController'
               
});
               
                $routeProvider
.otherwise('/about');

and then I added 

$locationProvider.html5Mode(true);

to remove # from the url. 

And now I have the issue with refresh. When I try to refresh my page, e.g. http://localhost:8080/axxyr/contact
I see 404 error


What is the problem with refresh when html5Mode is true? 
Please advise. 


Thanks

Sander Elias

unread,
Mar 7, 2015, 7:47:36 AM3/7/15
to ang...@googlegroups.com
Hi Polokh,

You need to adapt your server to allow this. If you hit refresh, your server is hit with the url. If it returns anything else then your index.html(usually!) you can run into this issue.
Recap, it's an server issue, not an angular one. Configure your sever so it returns your index.html for all routings, and your in busness.

Regards
Sander
Reply all
Reply to author
Forward
0 new messages