Here is extract of my service, I would like getIssues
metod to return observable, rather than promise resolving into observable as it would seem so much more clean. I am confident there is a way, I am just a bit too new to this.
import { Injectable } from '@angular/core'; (...)
@Injectable({ providedIn: 'root', })
export class IssueService {
private users!: Promise<Map<number, Users>;
constructor(private http: HttpClient, private userService: UserService) {
this.users = this.userService.getUsers()
}
getIssues() {
return this.users.then(users => {
return this.http.get<Iissue[]>(URL, OPTIONS).pipe(
map(issues => new Issue(issue, users)),
);
});
}
}