this.route.params.subscribe(params => {
if (params.id) {
this.formService.getFormFieldValById(params.id).pipe(take(1)).subscribe(res => {
// bind response to form
});
}
});
this.route.params.subscribe(params => {
if (params.id) {
this.formService.getFormFieldValById(params.id).pipe(take(1)).subscribe(res => {
// bind response to form
});
}
});
this.route.queryParams.pipe(
switchMap(({id}) => {
return this.formService.getFormFieldValById(id);
})
).subscribe(res => {
// bind response to form
})
Here you can chain each process rather than nesting subscriptions