Location replace state reloading problem

Hello everyone !

I need to modify the URL of the user without reloading.

So i use :

import { Location } from '@angular/common';

Everything work, but when I’m push and pop a page, the entire page reloading when poping the page.

Anyone has a solution ?

Thank you

cli packages: (/Users/dev/.virtualenvs/myapp/lib/node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.6-201712271536
    Cordova Platforms  : android 6.2.2 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.1-201711081842


    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2
    ios-sim           : 6.1.2
    Node              : v6.11.5
    npm               : 3.10.10
    OS                : macOS Sierra
    Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : /Users/dev/Library/Android/sdk


    backend : pro

I identified the problem. When using pushState with Ionic, push and pop a page. At pop, the controller refreshes itself. So if you have for example a map which is going to be initialized at ngAfterViewInit, it will initialize itself twice and generate an error.

On Angular with the router we can avoid this problem.

golfadas gave a solution. But with Ionic “router” we can’t do the same. Any ideas to avoid this kind of problem ?