This is because all routes have to go to the the index.html and angular-router will do its routing from there.
So get a node server up and running and redirect all request to index.html
this is how ur server might look like
import { json, urlencoded } from "body-parser";
import * as compression from "compression";
import * as express from "express";
import * as path from "path";
const app: express.Application = express();
app.disable("x-powered-by");
app.use(json());
app.use(compression());
app.use(urlencoded({ extended: true }));
if (app.get("env") === "production") {
// in production mode run application from dist folder
app.use(express.static(path.join(__dirname, "/../client")));
}
app.use('*', (req, res) => {
res.sendFile(path.join(__dirname, '/../client/index.html'));
});
// catch 404 and forward to error handler
app.use((req: express.Request, res: express.Response, next) => {
const err = new Error("Not Found");
next(err);
});
// production error handler
// no stacktrace leaked to user
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
res.status(err.status || 500);
res.json({
error: {},
message: err.message,
});
});
export { app };
you can clone this project and replace the angular app with yours