Use Params from Angular Routes Inside of Components

InstructorJohn Lindquist

Share this video with your friends

Send Tweet

Angular’s ActivatedRoute allows you to get the details of the current route into your components. Params on the ActivatedRoute are provided as streams, so you can easily map the param you want off of the stream and display it in your template.

Djen
~ 6 years ago

Is it also possible to pass objects between 2 components with router.navigate(['componentB', {a:value1,b:value2}]) and in componentB: activatedRoute.snapshot.paramMap.get('a') ?