2

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.

3
  • Does this help? stackoverflow.com/questions/48552993/… Commented Dec 3, 2021 at 9:14
  • so, when do I call this? Commented Dec 3, 2021 at 9:47
  • When you navigate to your desired component and want to remove the query parameter Commented Dec 3, 2021 at 12:38

1 Answer 1

3

In ngOnInit:

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

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

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.