Parameter routing and condition dont work on production mode
Solution 1:
The Angular web server acts as a reverse proxy which behaves like this:
- If the incoming requests matches a asset file (CSS, JS, image, ...), serve it
- Otherwise, serve the
index.html
file in order to execute the JavaScript code in the browser
When the index.html
is being served and the JavaScript executes, the current URL is treated like an Angular route and the corresponding layout/component is displayed.
Wherever you are trying to deploy, it should have URL rewriting abilities and you should configure it in order to mimic Angular's development server behavior.
Here are some useful resources for the three most popular web servers:
- Apache documentation
- Nginx documentation
- IIS blog article