The problem is that you enabled html5
, so that the route system works properly using $locationProvider.html5Mode(true);
you should also set the root of your app. This is done inside your head through the tag
<base href="/">
</head>
Or, if your app has a different root folder, set it there, for example:
<base href="/app/">
//ou
<base href="/app/adm/">
Another point to note (that I have already been through this problem) is that with this method may be that your links break, one of the solutions would be to use a /
before the definition of your links, such as css
, script
, etc.. For example, the following css
:
<link rel="stylesheet" href="dist/css/main.min.css">
Would look like this:
<link rel="stylesheet" href="/dist/css/main.min.css"> //Note a barra invertida antes do dist
Also remembering that for different servers, there are different solutions, as for example, in apache I needed to enable the module rewrite
, and so on. Test with these solutions I gave you, if you still don’t solve, your problem may be related to the server you are using.
Thanks friend, tomorrow I will test
– Daniel Swater
So, it worked. But now there’s one though, I’ve changed the structure and now the homepage is only in / (before it was /home). Now for example if I put /test, presents me the error page. From what I saw on the console, is not loading the "test.html", it shows only "test". This if I enable Html5. With it disabled is normal
– Daniel Swater
This should be associated with the way you mount your routes. I, for example, use ui-router and have set a default redirect. When the user accesses
site
orsite/
(for example) it automatically directs tosite/home
. Apart from that, it is also necessary to define a url for each stete. This using ui-router, which may be different for you if you use another route system.– celsomtrindade