Add map with search service using angularjs and google maps

2

I have a map and wish that it can be located and marked at a certain point by the address passed by the user. Example: The user types: calle são joão, 403, São Paulo, Sp. The map should return the point on the map for the address entered. html

<script src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false&key=AIzaSyDij4Z3AFhetKwsKd9dP6gd0jPceh4Y70I"></script><ui-gmap-google-mapcenter="map.center" zoom="map.zoom" events="map_events">
    <ui-gmap-marker idkey="123" coords="unit.coordinates" options="{ draggable: true }" events="marker_events"></ui-gmap-marker>
  </ui-gmap-google-map>

js

app.config(function(uiGmapGoogleMapApiProvider) {
  uiGmapGoogleMapApiProvider.configure({
    key: 'AIzaSyDij4Z3AFhetKwsKd9dP6gd0jPceh4Y70I',
    v: '3.20',
    libraries: 'places,weather,geometry,visualization'
  });
});

<!-- begin snippet: js hide: false console: true babel: false -->

I want to enable search there and I'm not getting it.

    
asked by anonymous 21.09.2017 / 21:41

1 answer

0

Use the GeoCode API.

http://maps.google.com/maps/api/geocode/json?address=rua são joão,403, São Paulo, Sp

Returns an object that contains the geometry.location property: { "lat" : -23.4346994, "lng" : -46.7748177} .

Font .

    
21.09.2017 / 22:09