IONIC - ANGULAR Why when click back button I have same multiple request?
Solution 1:
Every time you call ionViewWillEnter()
you create new route subscription.
You should unsubscribe from it.
Create property
private unsubscribe$ = new Subject<void>();
use it to unsubscribe
this.route.paramMap
.pipe(takeUntil(this.unsubscribe$))
.subscribe(paramMap => {
And emit it whenever component destroys.
ngOnDestroy() {
this.unsubscribe$.next();
}
You can do this easier using a library @ngneat/until-destroy.
Or simply make sure you only initialize it once: if you only change parameter in your router it might not recreate your component - depending on onSameUrlNavigation config.
It would help if you showed how/when you call ionViewWillEnter()
.