pKay
pKay

Reputation: 1840

Getting error while subscribing. subscribe is not a function

  var a$= from(['aaaa','bbbb'])
        var b$=from(ajax(`https://api.myjson.com/bins/no8tj`))
        a$.pipe(mergeMap(post => b$).subscribe(res => console.log(res)));

I am trying to make use of mergeMap operator. But while subscribing i am getting an error 'TypeError: Object(...)(...).subscribe is not a function'. I am trying out this example from the following link https://netbasal.com/rxjs-six-operators-that-you-must-know-5ed3b6e238a0

Upvotes: 0

Views: 681

Answers (1)

Fan Cheung
Fan Cheung

Reputation: 11345

You should subscribe to pipe() instead of mergeMap try

a$.pipe(mergeMap(post => zip(b$,of(post)))).subscribe(res => console.log(res));

Upvotes: 3

Related Questions