Angular-google-maps: AGMにはPlacesServiceがありますか? 私はそれを機能させることができないようです。

作成日 2018年02月23日  ·  3コメント  ·  ソース: SebastianM/angular-google-maps

問題の説明
Placesサービスを使用して「nearbySearch()」を実行しようとしています

再現する手順と問題の最小限のデモ

public findHospital(){
map = new google.maps.Map(document.createElement( 'div'));
var PlacesService = new google.maps.places.PlacesService(map);
var place:any = Observable.bindCallback(placesService.nearbySearch);

var pyrmont = new google.maps.LatLng(19.107567, 72.8335)
var request = {
  location: pyrmont,
  radius: 200,
  types: ['hospital', 'health'] // this is where you set the map to get the hospitals and health related places
};

return place(request)
  .map((response) => {
    let result: IDistanceResult;
    console.log(response);
    return result = {
      directions: response[0],
      status: response[1]
    }
  });

}

_問題を確認するには、デモでどのような手順を試す必要がありますか?_

現在の動作
Uncaught TypeError:未定義のプロパティ 'nearbySearch'を読み取ることができません

期待される/望ましい動作
近くの場所のリストを返す

angle2&angular-google-mapsバージョン
最新

その他の情報

DirectionsServiceが正常に機能しているように見えるので、Placesサービスも正常に機能すると思いました。

全てのコメント3件

おそらく次のものだけを使用する必要があります。
var service = new google.maps.places.PlacesService(document.createElement('div'));
他の場所でマップを使用している場合を除きますが、とにかくPlacesServiceはこのライブラリの一部ではないため、この問題はAGMとは関係ありません。

@jgutixがサービスのインスタンス化に関して言ったことを繰り返したいと思いましたが、実際にはそのように正常に機能します。私はtextSearchを使用します。

正しく動作しましたが、Observable.bindCallback()では動作しないようです

このページは役に立ちましたか?
0 / 5 - 0 評価

関連する問題

n1t3w0lf picture n1t3w0lf  ·  3コメント

matishw picture matishw  ·  3コメント

Subhojit1992 picture Subhojit1992  ·  3コメント

alexweber picture alexweber  ·  4コメント

supran2811 picture supran2811  ·  4コメント