File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ <h2>{{marker.name}}</h2>
119119 location : {
120120 type : Object ,
121121 value : null ,
122- readyOnly : true
122+ readOnly : true
123123 }
124124 } ,
125125
@@ -128,6 +128,13 @@ <h2>{{marker.name}}</h2>
128128 '_updateLocation(latitude,longitude)'
129129 ] ,
130130
131+ /**
132+ * Fired when the details of a place are returned.
133+ *
134+ * @event google-map-search-place-detail
135+ * @param {google.maps.MarkerPlace } detail The place details.
136+ */
137+
131138 /**
132139 * Fired when the search element returns a result.
133140 *
@@ -166,6 +173,26 @@ <h2>{{marker.name}}</h2>
166173 }
167174 } ,
168175
176+ /**
177+ * Fetches details for a given place.
178+ * @param {String } placeId The place id.
179+ * @return {Promise } place The place information.
180+ */
181+ getDetails : function ( placeId ) {
182+ var places = new google . maps . places . PlacesService ( this . map ) ;
183+
184+ return new Promise ( function ( resolve , reject ) {
185+ places . getDetails ( { placeId : placeId } , function ( place , status ) {
186+ if ( status === google . maps . places . PlacesServiceStatus . OK ) {
187+ resolve ( place ) ;
188+ this . fire ( 'google-map-search-place-detail' , place ) ;
189+ } else {
190+ reject ( status ) ;
191+ }
192+ } . bind ( this ) ) ;
193+ } . bind ( this ) ) ;
194+ } ,
195+
169196 _gotResults : function ( results , status ) {
170197 this . results = results . map ( function ( result ) {
171198 // obtain lat/long from geometry
You can’t perform that action at this time.
0 commit comments