Google Maps Place Autocomplete work only once


#1

Hi all,

I’m working on ionic 3 and I have add the Google Maps Place Autocomplete to an input tag.
I have add these pieces of code:

index.html

script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAOyCVi_EH1cPheAu12hzDj5r3IrBtT6Ng&libraries=places"></script>

page-controller.ts

ionViewDidEnter() {
    let places = document.getElementById('city').children[0];
    let autocomplete = new google.maps.places.Autocomplete(places);
  }

but it works only once, when I refresh page.

In fact, if I click on the save button in the pageController (that save user data and bring me back in homeController) and I return on this page, the Autocomplete doesn’t work anymore.

Can someone help me please?