Android – auto fill cannot be selected from Google
I'm developing an ion application running on Android. On a specific screen, I have a Google map and a search box. I use Google map's mobile gap plug-in to get native maps instead of using Google map JavaScript API because it's too slow
The search box is automatically populated to get the location from Google using the following code –
input = document.getElementById 'search-input'
autocomplete = new google.maps.places.Autocomplete(input)
This will automatically fill in the input fields for google places. The problem is that I can't choose any options from the autocomplete drop-down list
My HTML code –
<ion-content scroll="false">
<div id="search@R_597_2419@">
<input id="search-input">
</div>
<div id="map-canvas">
</ion-content>
Map canvas contains maps. I try to add ng focus = "disabletap()" to enter search input
disableTap = ->
container = document.getElementsByClassName 'pac-container'
angular.element(container).attr 'data-tap-disabled', 'true'
angular.element(container).on 'click', ->
document.getElementById('search-input').blur()
I found this solution at this link
But it doesn't work. What's the input here? Here I end my wisdom
resolvent:
The following is useful to me. From user @ tillathehun0:
.controller('MyCtrl', function($scope) {
$scope.disableTap = function(){
container = document.getElementsByClassName('pac-container');
// disable ionic data tab
angular.element(container).attr('data-tap-disabled', 'true');
// leave input field if google-address-entry is selected
angular.element(container).on("click", function(){
document.getElementById('searchBar').blur();
});
};
})