Problem Statement
Show how to read route params and query params reactively.
Explanation
Use ActivatedRoute.paramMap and queryParamMap as Observables; combineLatest or switchMap them into service calls to react to navigation changes.
Code Solution
SolutionRead Only
combineLatest([
this.route.paramMap.pipe(map(p => p.get('id'))),
this.route.queryParamMap.pipe(map(q => q.get('tab')))
]).pipe(
switchMap(([id, tab]) => this.api.load(id!, tab))
).subscribe(vm => this.vm = vm);