Image for post
Image for post

You may already know how to create routes using the CouterConfig class, I suppose. So maybe you also have a route like this one:

{ path: 'theme/:themeId', component: ThemeComponent },

The question for me was then: How to get the :themeId inside the ThemeComponent.

The solution is to inject the ActivatedRoute into the component containing all information you need ;-)

import {ActivatedRoute} from '@angular/router';

(I was a little bit lazy not implementing a class for the subscribe function.)

Missing something, need more info/help?

Developer since the 80'th, working at Forschungszentrum Jülich ( …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store