It has nothing to do with your app itself. It has to do with the webserver it’s hosted on. For example, if you’re using Nginx, you have to make it SPA-aware with settings like the following:
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri /index.html;
}
}
If you’re on Netlify, you have to add a _redirects
file to your app.
I show how to configure Netlify in a screencast I did on Angular deployment. https://www.youtube.com/watch?v=Hx9SbQ1ANLk&t=1921s