Route to Home Page Angular

0

I have the following structure in my module

link

When I call the URL link , it includes the home.html view, so far so good. The problem is that when it's in that URL and I give an enter, it gives me a message that the page was not found. Same thing if I type the URL and put the / home at the end, it gives me the same error. Does anybody know how to solve this? Thanks

    
asked by anonymous 05.04.2016 / 22:24

1 answer

1

The problem is that you have enabled html5 , so that the routing system works correctly using $locationProvider.html5Mode(true); you must also define the root of your app. This is done inside your head through the

    <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 is that with this method your links might break, one solution would be to use / before setting your links, such as css , script , etc. For example, the following css :

<link rel="stylesheet" href="dist/css/main.min.css">

It would look like this:

<link rel="stylesheet" href="/dist/css/main.min.css"> //Note a barra invertida antes do dist

Also remember that for different servers, there are different solutions, for example, in apache I needed to enable the module rewrite , and so on. Testing with these solutions I gave you, if it still does not solve, your problem may be related to the server you are using.

    
05.04.2016 / 23:19