0

I'm trying to get queryparams from URL in service. I am taking params using this

URL: http://localhost:4200/?param1=15&param2=abcdef

this._activeRoute.queryParams.subscribe((params: Params) => {
        this.p1 = params['param1'];
        this.p2 = params['param2'];
});

so, now I got params in this.p1 and this.p2 I want to clear the queryparams from URL like, http://localhost:4200/

Please suggest me a way here

Nikhil Radadiya
  • 1,995
  • 2
  • 20
  • 43

1 Answers1

0

You need to navigate back to the same with empty params like refer this Route params clearing

Sahil Kashetwar
  • 159
  • 1
  • 7
  • `this._router.navigate(this._router.url, { queryParams: {}});` I'm getting `argument of type 'string' is not assignable to parameter of type 'any[]'.)` – Nikhil Radadiya Aug 11 '17 at 06:05