【问题标题】:Tap on Response from Google Search Places API in Ionic在 Ionic 中点击来自 Google Search Places API 的响应
【发布时间】:2016-12-17 17:23:06
【问题描述】:

我正在使用 Ionic 框架开发 android 应用程序,我在其中使用地图并放置了一个搜索框。但是,当我在文本框中搜索地点时,该位置显示为下拉列表,但无法在我的 Android 手机中使用点击或单击来选择它。任何人都可以通过在设备中点击它来帮助如何选择位置吗?这是我手机的屏幕截图。我想通过点击它来选择位置,但无法这样做。

这是我的 html 代码:

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

这是我的控制器代码:

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

【问题讨论】:

    标签: javascript android angularjs google-maps-api-3 ionic-framework


    【解决方案1】:

    为输入框添加更改事件

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

    然后在函数中添加这段代码

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多