2016-09-18 2 views
1

提案ロードされません。要するに角度:Googleのオートコンプリートは、PC上で動作しますが、モバイル上でタップすると、私は実際には同じ問題を抱えてい

can't tap on item in google autocomplete list on mobile

:私はGoogleのオートコンプリートの提案をタップして、モバイルでは動作しませんが、PC上ではうまく動作します。

しかし、コードジェネレータは使用していません。私は確かにFastClickが有効になっていたが、無効にすると問題は解決しませんでした....

EDIT:ここでは完全を期すために私のコードだ: マークアップ(ヒスイ):

div 
    input(type="text" id="fulladdress" name="fulladdress" ng-model="location" class="form-control text-field" placeholder="Start typing...") 

とビューで:

form.row(ng-show="vm.isLogged" name="vm.form") 
    h2.order-title Delivery address 
    label(for="address") Address 
    google-places(location="vm.address") 

JS:

'use strict'; 

GooglePlacesDirective.$inject = ['$animate', 'Zipcode']; 

function GooglePlacesDirective($animate, Zipcode) { 
    return { 
     scope: {location:'='}, 
     restrict: 'E', 
     replace: true, 
     template: require('./google-places.html'), 
     link: link 
    }; 

    function link(scope, element) { 
     scope.codeNotServed = false; 
     var options = { 
      componentRestrictions: {country: "us"} 
     }; 
     var autocomplete = new google.maps.places.Autocomplete($("#fulladdress")[0], options); 
     google.maps.event.addListener(autocomplete, 'place_changed', function() { 
      scope.codeNotServed = false; 
      var place = autocomplete.getPlace(); 
      var parts = place.address_components; 
      //do things with the parts; I've also tried doing nothing with the parts, but it didn't work either 
     }); 
    } 
} 

module.exports = GooglePlacesDirective; 

答えて

0

オーケー - コメントアウトするだけでなくコード:

/* 
if ('addEventListener' in document) { 
    console.log("Attaching FastClick event listener"); 
    document.addEventListener('DOMContentLoaded', function() { 
     FastClick.attach(document.body); 
    }, false); 
} 
*/ 

だけでなく、ライブラリーの実際のLOADING:

<!-- 
<script src="/bower_components/fastclick/lib/fastclick.js"></script> 
--> 

は、問題を解決しているようです!

関連する問題