You can easily have parameters in Angular routes if they are a full segment in the URL, so you can have for the following URLs:
- /music/german
- /music/french
the route:
{ path: 'music/:language', component: MusicComponent }
, which passes language
as a parameter to the MusicComponent
.
How do you handle though parameters that are inside a URL segment, so matching for example the following URLs and getting the language
parameter from them:
- /learn-german-with-music
- /learn-french-with-music
Doing this DOESN'T work:
{ path: 'learn-:language-with-music', component: MusicComponent }