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)));
我正在尝试使用mergeMap运算符。但是在订阅时出现错误'TypeError:Object(...)(...)。subscribe不是函数'。我正在从以下链接尝试此示例 https://netbasal.com/rxjs-six-operators-that-you-must-know-5ed3b6e238a0
答案 0 :(得分:2)
您应该订阅pipe()
而不是mergeMap
试试
a$.pipe(mergeMap(post => zip(b$,of(post)))).subscribe(res => console.log(res));