While working on my angular 7 app, I encountered an issue when navigating to the component report details.
When using router link, it only creates a URL in the browser but does not actually redirect until I click Enter.
The routing works correctly only if I use href instead.
Both href and router link generate the same URL link:
http://localhost:4200/reportdetails?id=2028
When using router link, I specify it as follows:
<a [routerLink]="['/reportdetails']" [queryParams]="{id: subrep.reportID}" >
When using href, I write it like this:
<a href="/reportdetails?id={{subrep.reportID}}">
In approutingmodule.ts:
const routes: Routes = [
{path:'',redirectTo: 'ReportCategoryComponent', pathMatch: 'full'},
{path:'report',component:ReportCategoryComponent},
{path:'reportdetails',component:ReportdetailsComponent},
{path:'reportdetails/:id',component:ReportdetailsComponent}
];
So how can I solve the issue of router link redirection?