I need to subscribe several times to get the correct data from my NoSQL database. To get a list of users for a specific project, I do the following:
ngOnInit() {
this.projectService.getCurrentproject().take(1).subscribe(projectData => {
console.log('Got project data.');
this.af.database.list('/project_roles/'+projectData.$key)
.subscribe((userMeta) => {
});
});
}
As you can see, the subscription is inside the subscription inside the subscription .. And each subscription depends on the previous reslt.
Subscription 3 and 4 may be parallel.
The code works well, but am I missing something, or so I believe that I work with several subscriptions, that the result of the previous one depends on the following?
Update . It looks like the issue is with Subscription 2. The subscription is not finished yet, but I'm starting to iterate over the list, which gives me a double list of users!