merge in rxjs

questionsmerge in rxjs
Suhash asked 2 years ago

Hi 
how can i use merge in RXJS? explain MERGE in RXJS with example.
 

2 Answers
admin Staff answered 2 years ago
Here is example of merge in rxjs.

const first = Rx.Observable.from([1,2,3]); const second = Rx.Observable.from([6,7,8,9]); Rx.Observable.merge( first, second ).subscribe(dd=>{console.log(dd)})

For more details you can visit here

 

shyam answered 2 years ago

Hi 
You can use merge with array of object like this
const first = Rx.Observable.from([{“name”:”san”, “email”:”san@gmail.com“},
{“name”:”shyam”, “email”:”shya@gmail.com“}])
 
const second = Rx.Observable.from([
{“name”:”shya”, “email”:”shya@gmail.com“,”mob”: “96xxxxxx47”}])
 
 
Rx.Observable.merge(
first, second
).subscribe(dd=>{console.log(dd)})