constructor(
private route: ActivatedRoute,
private http: Http
){
// Retrieve parameter changes observable
let paramObs = route.paramMap;
// Fetch data once only
let dataObs = http.get('...');
// Subscribe to both observables together
// and utilize their resolved values in the same scope
}
Is there a method similar to forkJoin
that is triggered each time a parameter change occurs? Note that forkJoin
depends on all observables being completed.
I'm hoping for an alternative approach to handle this without getting into callback hell. Any suggestions complying with this requirement would be appreciated.