This uses input tag. If anyone has any better solution to do this, please help.
That works fine : I found this issue though:
No text-clear button.
(Did it manually by adding close button at the end of search-bar.
On-click will clear the text.
But, then keyboard disappears after pressing close, which is correct behaviour ideally, but, I want it to stay).
This worked incredibly well. Even for worldwide searches, like i needed. Thanks! I may have read a few other of your posts,
and all are very practical and work well.
here’s a workable function to zoom to the location you’re looking for. In my case it’s vineyards and specific regions. so just search for say, Napa Valley, or Francis Ford Coppola Winery, and,
gotoLocation(){
let place = document.getElementsByClassName(‘searchbar-input’)[0];
var placeLat = this.autocomplete.gm_accessors_.place.Fc.place.geometry.viewport.f.f;
var placeLong = this.autocomplete.gm_accessors_.place.Fc.place.geometry.viewport.b.b;
let latLng = new google.maps.LatLng(placeLat, placeLong);
let mapOptions = {
center: latLng,
zoom:12,
mapTypeId: google.maps.MapTypeId.HYBRID
}
this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
}
Hey @Schmidt, It’s working for me but now I’m not able to detect the click event on the drop-down locations, do you know how to get that location and set the lat, long on the map?