Hello!
I want to subscribe to a Service and pass the data to another Service and subscribe it.
I triet the following but the second result is Always undefined.
ngOnInit() {
this.taskService.getTasks().subscribe(res => {
this.tasks = res;
this.loadSubjects();
});
}
async loadSubjects() {
for(let task of this.tasks) {
this.subjectsService.getSubject(task.subjectId).subscribe(subject => {
task.subject = subject;
console.log(subject);
});
}
}
The Services are fine. I testet both in single subscribtion. only then i tried to compine them, it failes.
Hope somebody can help me!
Thanks!