Before removing the hash sign, I had
mainApp.config(function ($locationProvider, $routeProvider) {
$routeProvider
.when(\'/page\', {
controll
That's expected. Here's what happens when html5 is not turned on:
http://localhost:8080/index.html#/main
in the address barNow what happens when you enable html5 mode and load index.hml?
http://localhost:8080/index.html
in the address barNow, what happens if you hit refresh, or directly enter http://localhost:8080/main
in the address bar? Well in that case, you're saying the browser: "please load the page at the url http://localhost:8080/main
. So that's what the browser does: it sends an HTTP request to http://localhost:8080/main
. Since the server doesn't have anything at this address, it sends back a 404.
Now how to make it work? It's actually quite simple: you need to configure the server to send back the index.html page when it gets a request for the path /main
(and for all the other paths of the angular application). That way, the browser will load the HTML page, the angular application it contains will be restarted, the angular router will parse the path (/main
) from the URL, and it will thus load the view and the controller associated to that path.