In my angular project i have a route as a
path: 'friend/messages/:encryptedKey/:type',
component: EncryptedRouteComponent,
canActivate: [AuthGuard],
,
path: '**',
component: PageNotFoundComponent,
if i hit url as
baseUrl/friend/messages/NjgzMw==/inbox
i am navigating to PageNotFoundComponent component and there i gets url as only
baseurl/friend/messages/NjgzMw
thats why its not going to EncryptedRouteComponent how to fix this
this is my code snippet of PageNotFoundComponent
in PagenotFoundComponent i want decoded url as
friend/messages/NjgzMw/inbox
so that i will successfully navigate to EncryptedRouteComponent
I am unable to replicate the scenario in stackblitz, but you can use
encodeURIordecodeURIto pass the keys if you have problems parsing them normally!You can also use
encodeURIComponentanddecodeURIComponentfor this!reference answer
child
stackblitz