I create a small angular 2 sample app, where I can demonstrate a routing problem. I define the following routes:
@RouteConfig([
{ path: "/login", name: "Login", component: Login },
{ path: "/sites/site1", name: "Site1", component: Site1 }
])
Navigation to Site1 with the following instruction works:
this.router.navigate(["Site1", {}]);
If I call the site directly from the browser doesn't works. In my case http://127.0.0.1:8080/static/sites/site1
. But calling the login site directly works: http://127.0.0.1:8080/static/login
Note: In this case '/static' is my base href.
It seems as the problem only occurs on routes, where the path is deeper than one level. The first site after the base href works (e.g login). Call a deeper site doesn't work (e.g site/sites).
The problem could reproduced with the following app: https://github.com/lexon0011/IssueDemonstrator
- Clone the repository, install node modules and start the app (see Get started)
- Click the button "Show Site 1": You can see that the routing works
- Call the url directly: You can see that the routing doesn't works
Any ideas???
Thanks!!