Angular ActivatedRoute subscription with same query parameters

59 views Asked by At

I have a ActivatedRoute subscription in my angular app which performs some action upon query parameters change. But, when I pass same parameters as previous params the subscription in not triggering. How can the subscription trigger even for same params? I am using dates as parameters. So, there can be same date passed as params multiple times. I tried queryParamsHandling: "merge" | "preserve" | "" .

  public constructor(private ac: ActivatedRoute) {}
    
  public ngOnInit(): void {
    this.ac.queryParams.subscribe((params) => {
      console.log("params", params);
    });
  }
  
  private updateDateQueryParam(): void {
    this.router.navigate([], {
      relativeTo: this.route,
      queryParams: {
        to: this.endDate,
        from: this.startDate,
      },
      queryParamsHandling: "",
    });
  }

0

There are 0 answers