我有一个发出对象数组的可观察对象。我需要使用哪些管道操作符将其转换为 Observable 以便我可以对每个对象进行操作?
我需要对 obs$ 做些什么才能使其像 obs2$ 一样发射?
const obs$ = of([{ opponent: 'Walton', team: 'varsity', gametime: new Date() },
{ opponent: 'Scott', team: 'varsity', gametime: new Date() },
{ opponent: 'Dixie', team: 'varsity', gametime: new Date() },
{ opponent: 'Highlands', team: 'freshmen', gametime: new Date() }])
.pipe(
tap(console.log)
);
obs$.subscribe(a =>
console.log(a)
);
const obs2$ = of({ opponent: 'Walton', team: 'varsity', gametime: new Date() },
{ opponent: 'Scott', team: 'varsity', gametime: new Date() },
{ opponent: 'Dixie', team: 'varsity', gametime: new Date() },
{ opponent: 'Highlands', team: 'freshmen', gametime: new Date() })
.pipe(
tap(console.log)
);
obs2$.subscribe(a =>
console.log(a)
);