i am using google auto complete in my IOS Ionic 2 app. When i start typing an address in a field the matching addresses appear ok in a drop down list but if I select one, the ion-input field is not populated. Could anyone help me how to fix this?
This is my template:
<ion-item>
<ion-input id="journey_from" name="journey_from" type="text" placeholder="" [(ngModel)] = "location"></ion-input>
</ion-item>
This is my component:
ngAfterViewInit(){
let options = {
componentRestrictions:{
country: 'IN'
},
types: ['(regions)']
}
let input = document.getElementById('autocomplete').getElementsByTagName('input')[0];
let autoComplete = new google.maps.places.Autocomplete(this.autocomplete.nativeElement,options );
google.maps.event.addListener(autoComplete,'place_changed', () => {
this.placeSelect = autoComplete.getPlace();
this.location= this.placeSelect.formatted_address;
this.changeDetect.detectChanges(); });