Mr.H. Mr.H. -4 years ago 104
AngularJS Question

Loosing hash (#) in Angular URL using ui-router

my singlepage angularjs application can be accessed through the root address of my webserver like.

localhost:8080/

When I chose to go for example to the home-state the application is supposed change the url in the browsers addessfield to
localhost:8080/#/home
where the first part (
localhost:8080/
) points to my angular application and the second part (
#/home
) points to the home-states url.

But instead of doing what it's supposed to do my angular-application changes the url in the browsers addressfield to
localhost:8080/home
which on reload obviously creates a 404.

Can any of you tell me what I am doing wrong or at least give me a hint on where to look?

Answer Source

disable the html5 mode from the config. add/change the following line in the config

$locationProvider.html5Mode(false);

This will add the # to your url.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download