Ionic 2 Angular 2 plus How to remove parameters in URL Address?+

Issue

Long story short in my app the user receives an email notification which has hyperlink to open a certain record for a given id number. It looks something like this:

https://myappserver.com/?aid=12343551

The question I have is once the user opens the record is it possible to change the URL through ionic? I would like to change the url after opening and remove the parameter so it looks like this https://myappserver.com/

I can retrieve the URL through this.platform.url() but I don’t know how to change it.

Solution

You can use Location from @angular/common. Then you can use it like:
this.location.replaceState('/'). Here is the reference.

Answered By – Efe

Answer Checked By – Willingham (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.