3

I'm having trouble with the routing, it's all works fine when I route between pages using <a href="/someurl"> on the page.

When I input the link directly into the browser with the # like http://localhost/#/someurl it works fine also.

But if I enter it without the # like http://localhost/someurl I get Cannot GET /task/2

I'm using the HTML5 mode in angular $locationProvider.html5Mode(true); The backend is Web API build with MVC4 C# so only routing is controlled with app.js (angular)

ArniReynir
  • 849
  • 3
  • 12
  • 29

1 Answers1

2

If you want to use the $locationProvider's html5Mode, you'll have to couple it with some server tweaks so that your web server knows to serve up the same content regardless of path.

If you're using Apache for example, you can use mod_rewrite.

Langdon
  • 19,875
  • 18
  • 88
  • 107