Reputation: 155
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(); });
Upvotes: 0
Views: 660
Reputation: 66
UPDATE
You probably use the CDVUIWebViewEngine. Try to update to WKWebView to resolve your problem ;) You can find here how to upgrade your web view engine. If you use angularhttp, you'll need to use ionic-native@http instead for iOS (best way to resolve cors issues with angular-http and WKWebView). Good luck guys :D
Upvotes: 1