Manoj G
Manoj G

Reputation: 53

Angular app fails to match route on query param

I have an Angular 14 application which by default load as

https://abc/checkout/index.html

but at sometimes I get the URL as

https://abc/checkout/index.html?isAddrPassedFromVSI=false&token=EC-7F3328316X938605Y&PayerID=3G93VFQNSW3PL

My route config is as follows,

routes: Routes = [
  {
    path: '',
    component: CheckoutComponent,
  },
  {
    path: 'checkout',
    component: CheckoutComponent,
  },
]

On second URL with query param, which I can ignore Im getting an error and page doesnt load

enter image description here,

Please help what should I fix here

Upvotes: 0

Views: 342

Answers (1)

moutia RP
moutia RP

Reputation: 21

try this

 routes: Routes = [
  {path: '', redirectTo: '/checkout', pathMatch: 'full'},
  {path: 'checkout',component: CheckoutComponent}
]

Upvotes: 1

Related Questions