Issue
I have followed the below procedure.
- ng build –base-href=/myapp/
- Deployed into the tomcat server
- Accessing: http://localhost:8080/myapp/ (open home page)
After refreshing the home page, it is giving a 404 error page.
Solution
try using HashLocationStrategy. Put useHash: true
while defining your routes:
@NgModule({
imports: [
...
RouterModule.forRoot(routes, { useHash: true })
https://angular.io/guide/router#hashlocationstrategy
Answered By – Abdul Rafay
Answer Checked By – Mildred Charles (AngularFixing Admin)