I have a method in an angular component whose content is :
this.route.paramMap.pipe(
switchMap((params: ParamMap) => {
let fooValue = params.get('selectedid');
console.log("inside switch map with value as " + fooValue);
return fooValue;
})
)
This Observable is assigned to type Observable<string>.
Now when I subscribe to above, and if selectedid = ABCD, then I get 4 invocations of the next() method one each for A, B, C, D. What is the reason for this?
This is happening only with switchMap and not with map operator.
When I use this.router.navigate(['/mypath', path.id]);
and use a switchmap with it, it doesn't split the string. its happening with this.router.navigate(['/mypath1', { selectedid: obj.id, foo: "foo" }]);
syntax