I am looking for a solution in the following problem:
I have 3 separate functions. The first two functions fire up a plugin which requires the user’s manual input in the process.
The third function only has a console log. I would like to have a 4th one, that fires up the first 2 functions simultaneously, then upon completing them the 3rd one is fired.
The problem is, that upon firing up function4, function1-2 fires up, but when the user input is due (plugin response), without completing them first, function3 is fired.
I also tried the promises with .then statements with no luck.
I have tried your method:
Unfortunately, the forkJoin.subscribe event is not executed.
function1 and 2 is executed correctly, yet function 3 (also tried with a single console.log) is not working.
Maybe the first two functions are not really “completed”.
Any suggestions?
The error reads:
“core.js:1350 ERROR Error: Uncaught (in promise): TypeError: You provided ‘undefined’ where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
TypeError: You provided ‘undefined’ where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.”
While it won’t bite you when using Promises (or one-shot Observables like those ordinarily returned by HttpClient), forkJoin can be tricky if you feed it long-lived Observables. It won’t complete until all of its arguments do, so even if the underlying Observables are emitting, you won’t see a peep out of forkJoin until they all complete.