Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Are you suggesting to dynamically route from angular root? Commented Sep 13, 2019 at 6:38
  • You have to, if you want to use the normal angular routing. Your server only knows the angular-base-route and the whole angular application works on it. Everything else is angular magic. Commented Sep 13, 2019 at 6:53
  • To add on to @Gollm, in a normal web server, when you try to access /category/fruits.html, the web server looks for fruits.html file in /category directory (folder). If it exists, the html file is served. If not, 404 is returned. Angular, however, has it's own internal routing implementation. When you access /category, the web server again tries to find /category directory, which it wouldn't find. So it correctly returns 404. This is why you have to route a 404 response to /index.html which will trigger Angular's internal routing to /Category route. Commented Sep 16, 2019 at 16:57
  • You can observe this when you run ng s anyway, you will see this line: 「wds」: 404s will fallback to //index.html. Commented Sep 16, 2019 at 16:58