I have multiple promise functions as:
function test1(){
const numberPromise = new Promise((resolve) => {
resolve(1);
});
return numberPromise;
}
function test2(){
const numberPromise = new Promise((resolve) => {
resolve(2);
});
return numberPromise;
}
function test3(){
const numberPromise = new Promise((resolve) => {
resolve(3);
});
return numberPromise;
}
I want to call it parallel just like Promise.all([test1(),test2(),test3()]) but I don't want to use promise, I want to use Observable.
To get this done I am doing this:
import { Observable } from 'rxjs/Observable';
var data=Observable.of(test1(),test2(),test3());
data.subscribe((data)=>{
console.log("data :",data);
})
But I am getting the result like :

But I want to get this like :
data :1
data :2
data :3
[1]: https://i.sstatic.net/0wamC.png