I've updated from Angular 5
to Angular 6
. Now I'm trying to update my code to make it compatible with RxJS 6
.
.pipe(
map(job => job[0]),
switchMap((job) => {
return job ? this.bookingService.findByID(job.property.id) : Observable.empty();
}, (job: Job, bookings: Booking[]) => {
this.mark_jobs_unavailable(job, bookings);
return job;
})
)
I'm getting warning on using switchMap that Deprecated Symbol is used
.
These are my imports: import {map, switchMap} from 'rxjs/operators';
Is there any alternative way to use switchMap in v6? Also, If I don't change my code the rxjs-compat
should make my existing code work (which i have installed) but I get the following error with the same code but in RxJS 5 style:
.map(job => job[0])
.switchMap((job) => {
return job ? this.bookingService.findByID(job.property.id) : Observable.empty();
}, (job: Job, bookings: Booking[]) => {
this.mark_jobs_unavailable(job, bookings);
return job;
})
Error: Expected 1 argument but got 2
.
.pipe(
map(job => job[0]),
switchMap((job) => {
return job ? this.bookingService.findByID(job.property.id).pipe(
map((bookings: Booking[]) => {
return {
job: job,
bookings: bookings
};
})
) : Observable.empty();
}
).subscribe((job, bookings: Booking[]) => {
...
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With