Is there a way to get a value that was emitted in a Subject or BehviourSubject by awaiting it with the toPromise() method?
I have tried using the first() operator, as well as the take(1) operator and that, did not seem to work as I have expected.
Something along the lines with the following would resemble my problem:
async function testSubjectToPromise() {
const sub = new Subject<string>();
sub.next("Hello");
const response = sub.toPromise();
console.log("Task added");
const result = await response;
console.log("Task completed");
}
testSubjectToPromise().finally(() => console.log("Done"));