1

I am adding a parameter to URL when clicking on a 'EDIT' button

    public editCustomFields() {      
      this.router.navigate(['.'], { relativeTo: this.route, queryParams: { view: 'edit' }});      
    }

Thenk the URL becomes

https://someurl.com/grids/admin/custom-fields?view=edit

But, when I manually refresh the browser, I am not able to remove those parameters from the URL. Please suggest on how can I this. Thanks.

vamsi
  • 1,488
  • 3
  • 28
  • 66

1 Answers1

1

In ngOnInit:

this.router.navigate([], { queryParams: {} });

will stay in the same page, and remove the query params after manual refresh.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 18 '22 at 20:57