ahmed elbarbary

ahmed elbarbary

  • 1.1k
  • 871
  • 36.1k

when routing using router Link it create url but nothing hap

May 22 2020 10:12 PM
when make routing using router Link it create url correct but not redirect to component and display data?
 

I work on angular 7 app I face issue when route to component report details

using router link it only create URL link on browser but not redirect to

component report details until I click Enter.

It only working routing correctly if I use href .

If I use href or router link two both generate same URL link

  1. http://localhost:4200/reportdetails?id=2028

If I use router Link I write router link as :

  1. "['/reportdetails']" [queryParams]="{id: subrep.reportID}" >  

When use href I write as below :

  1. "/reportdetails?id={{subrep.reportID}}">  

approutingmodule.ts :

  1. const routes: Routes = [ {path:'',redirectTo: 'ReportCategoryComponent', pathMatch: 'full'}, {path:'report',component:ReportCategoryComponent}, {path:'reportdetails',component:ReportdetailsComponent}, {path:'reportdetails/:id',component:ReportdetailsComponent} ];  

so How to solve of issue of router link redirect?


Brought to you by:

Answers (1)