I am trying to learn Angular and I have created a simple web application. I build the application using
ng build --prod
and has deployed it in the tomcat server.
The application gives 404 error whenever I try to hit any url directly other than the home url. (The application is completely frontend and there is no backend involved)
Home page url - http://54.160.203.76:8080/passgen/ - this loads perfectly fine.
Other Url - http://54.160.203.76:8080/passgen/feedback - this gives 404 error.
//routes array
const routes: Routes = [
{ path: '', component: PassgenComponent },
{ path: 'passphrase', component: PassphraseComponent },
{ path: 'strength', component: PassStrengthComponent },
{ path: 'feedback', component: FeedbackComponent },
{ path: '**', redirectTo: '' },
];
// code snippet to use the routes
<div class="nav-links">
<div routerLink="" (click)="navSlide()">Password</div>
<div routerLink="strength" (click)="navSlide()">PassStrength</div>
<div routerLink="passphrase" (click)="navSlide()">Passphrase</div>
<div routerLink="feedback" (click)="navSlide()">Feedback</div>
</div>
//index html base href
<base href="./"/>