Could someone assist me with a coding issue I'm facing? If the id is null, I need variable x to be true. I am unable to use if and else statements within the pipe. Any guidance would be greatly appreciated.
private x = false;
private y = false;
ngOnInit() {
this.subscribe = this.route.params.pipe(
map(({ id }) => id),
filter(id => !!id), // <---- here
switchMap((id: string) =>
this.shippingService.getShippingById(id)))
.subscribe(
res => {
this.shippingData = res;
this.y= true;
},
err => this.error = err.error,
);
}