I am using forkJoin to subscribe multiple inner observable. How can I flat nested array to single level array.
const x$ = of([1, 2, 3, 4]);
const y$ = of([2, 4]);
x$.pipe(
switchMap((t) => {
const innerArr$ = t.map((z) => y$.pipe(map((_) => _.map((y) => y * z))));
return forkJoin(innerArr$);
})
).subscribe(console.log);
Playground Link: Rxjs stackblitz
Expected Output:
[2,4,4,8,6,12,8,16]