Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular2:如何获得google place';从地点id的照片?_Angular_Typescript_Angular2 Google Maps - Fatal编程技术网

Angular2:如何获得google place';从地点id的照片?

Angular2:如何获得google place';从地点id的照片?,angular,typescript,angular2-google-maps,Angular,Typescript,Angular2 Google Maps,我想从angular2应用程序中的PlaceID检索google place照片。我从自动完成方法中获取placeId 我正在使用angular2谷歌地图库 } 通过使用place_id或Lattude和longitude,我想获取该地点的前10张照片。我被angular2谷歌地图困住了 你们能帮帮我吗。 谢谢。有了这个placeId,你就可以使用这个类了。调用getDetails方法,在回调中收到一个PlaceResult,它有一个photos属性(它是一个数组,您可以调用getUrl方法来检

我想从angular2应用程序中的PlaceID检索google place照片。我从自动完成方法中获取placeId

我正在使用angular2谷歌地图库

}

通过使用place_id或Lattude和longitude,我想获取该地点的前10张照片。我被angular2谷歌地图困住了

你们能帮帮我吗。
谢谢。

有了这个placeId,你就可以使用这个类了。调用
getDetails
方法,在回调中收到一个
PlaceResult
,它有一个
photos
属性(它是一个数组,您可以调用
getUrl
方法来检索可显示的图片)

(这意味着您已经检索了Place库以及核心google maps API库)

[编辑]

实际上,由于使用了
Autocomplete
,因此您已经有了
PlaceResult
,这就简单多了

function RetrievePhotoUrlsFromPlace(place) {

     var photos = place.photos;
     var urls = []; // we will store the urls here

          photos.forEach((photo) => {
            urls.push(photo.getUrl({
              maxWidht: 500, // at least set one or the other - mandatory
              maxHeight: undefined
            }));
          });

          /* You have your URLs here !! */
        }

有了这个placeId,您就可以使用这个类了。调用
getDetails
方法,在回调中收到一个
PlaceResult
,它有一个
photos
属性(它是一个数组,您可以调用
getUrl
方法来检索可显示的图片)

(这意味着您已经检索了Place库以及核心google maps API库)

[编辑]

实际上,由于使用了
Autocomplete
,因此您已经有了
PlaceResult
,这就简单多了

function RetrievePhotoUrlsFromPlace(place) {

     var photos = place.photos;
     var urls = []; // we will store the urls here

          photos.forEach((photo) => {
            urls.push(photo.getUrl({
              maxWidht: 500, // at least set one or the other - mandatory
              maxHeight: undefined
            }));
          });

          /* You have your URLs here !! */
        }

我按照您的解决方案进行了尝试,但出现了以下错误:google.maps.places服务不是一个构造函数您可能没有加载Place库是的,我添加了
AgmCoreModule.forRoot({apiKey:GOOGLEAPIKEY,libraries:[“places”]})
my bad它是
新的google.maps.places.places服务
,我更新我的帖子我们需要将
htmldevelment或Map
作为参数传递到
PlacesService()方法?根据您的解决方案,它给出了一个错误,无法读取未定义的属性'innerHTML',但得到这个错误google.maps.places服务不是一个构造函数您可能没有加载位置库是的,我添加了
AgmCoreModule.forRoot({apiKey:GOOGLEAPIKEY,libraries:[“places”]})
my bad它是
新的google.maps.places.PlacesService
,我更新了我的帖子我们需要将
HtmlLevel或Map
作为参数传递到
PlacesService()方法?它给出了一个错误,无法读取未定义的属性“innerHTML”
function RetrievePhotoUrlsFromPlace(place) {

     var photos = place.photos;
     var urls = []; // we will store the urls here

          photos.forEach((photo) => {
            urls.push(photo.getUrl({
              maxWidht: 500, // at least set one or the other - mandatory
              maxHeight: undefined
            }));
          });

          /* You have your URLs here !! */
        }