简体   繁体   中英

Tap on Response from Google Search Places API in Ionic

I am developing android Application using Ionic framework and I am using map in it and also put a search box. However when I search for places in textbox, the location appears as dropdown but unable to select it using tap or click in my android phone. Can anybody help to how to select location by tapping on it in device? Here is the screen shot of my phone. I want to select location by tapping on it but unable to do so.

在此处输入图片说明

here is my html code :

    <div class="phl">
        <input id="pac-input" class="controls" type="text" placeholder="Search Box" ng-model="vm.location.formatted_address">
    <div id="map"></div>

here is my controller code:

    var input = document.getElementById('pac-input');
    var searchBox = new google.maps.places.SearchBox(input);

Add a change event for input box

<input id="pac-input" class="controls" type="text" placeholder="Search Box" ng-model="vm.location.formatted_address" ng-change="disableTap()">

Then add this code in the function

function disableTap() {
    var container = document.getElementsByClassName('pac-container');
    angular.element(container).attr('data-tap-disabled', 'true');
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM