'Angular - Remove URL parameters on page refresh
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.
Solution 1:[1]
In ngOnInit:
this.router.navigate([], { queryParams: {} });
will stay in the same page, and remove the query params after manual refresh.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |