I am currently working on implementing the user profile page. While it would be easy to use the
/profile/user123
path by simply updating:
app-routing.module
{
path: 'profile',
loadChildren: () => import('./modules/profile/profile.module').then(m => m.ProfileModule)
},
profile-routing.module
{
path: ':username',
component: ProfileComponent
},
my aim is to create a more unique URL structure like /@user123
.
Despite my efforts, I haven't been successful in achieving this using the following approach:
app-routing.module
{
path: '@:username',
loadChildren: () => import('./modules/profile/profile.module').then(m => m.ProfileModule)
},
profile-routing.module
{
path: '',
component: ProfileComponent
},
Unfortunately, this method did not work as expected.
One potential solution that comes to mind is utilizing a Guard to check for the '@' prefix and redirecting to the /not-found
page if it's not present.
Do you have any suggestions on how to achieve this routing in a more "Angular" way?