Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.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
Javascript 带有google MapInfo窗口的Angular应用程序不';t在iphone上加载_Javascript_Angular_Iphone_Google Maps_Browser - Fatal编程技术网

Javascript 带有google MapInfo窗口的Angular应用程序不';t在iphone上加载

Javascript 带有google MapInfo窗口的Angular应用程序不';t在iphone上加载,javascript,angular,iphone,google-maps,browser,Javascript,Angular,Iphone,Google Maps,Browser,我已经建立了一个仪表板,主页上加载了一些带有谷歌地图的“卡片”。它适用于每一款浏览器和android手机。它只是不能加载到iPhone上。请参见下面的代码: export class LocationCardComponent implements OnInit, AfterViewInit { public data: ParkedLocationCardData; hasData: boolean; @ViewChild(MapInfoWindow, { static: f

我已经建立了一个仪表板,主页上加载了一些带有谷歌地图的“卡片”。它适用于每一款浏览器和android手机。它只是不能加载到iPhone上。请参见下面的代码:

export class LocationCardComponent implements OnInit,  AfterViewInit {

  public data: ParkedLocationCardData;
  hasData: boolean;

  @ViewChild(MapInfoWindow, { static: false }) infoWindow: MapInfoWindow

  mapOptions:MapOptions = {
    zoom: 12,
    disableDefaultUI: true,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    draggable: false,
    draggableCursor: 'pointer'
  }
  constructor() { }
  hasData: boolean;
public address:string;

  ngOnInit(): void {

      this.mapOptions.center =  new google.maps.LatLng(this.data.value.latitude, this.data.value.longitude);

      this.address = this.data.value.roadName != null && this.data.value.roadName.length> 0 ? this.data.value.roadName + ", " : ""
      this.address += this.data.value.town != null && this.data.value.town.length> 0 ? this.data.value.town  + ", " : ""
      this.address += this.data.value.postcode != null && this.data.value.postcode.length> 0 ? this.data.value.postcode + ", " : ""
      
      this.address = this.address.length > 1 ? this.address.substr(0, this.address.length-2) : this.address;
  }

  ngAfterViewInit() {     
       this.infoWindow.open();
  }  

}

以及HTML代码:

<a routerLink="/dashboard/{{data.title.toLowerCase()}}">
    <div class="card">
        <div class="card-header">
            <h5><i class="icofont icofont-location-pin mr-2"></i> {{data.title}}</h5>
        </div>
        <div class="card-body" style="min-height: 450px;" *ngIf="hasData">
            <google-map width="100%" height="100%" [center]="center" [options]="mapOptions" (click)="null"  >
                <map-marker [position]="mapOptions.center" [label]="label" ></map-marker>
                 <map-info-window [position]="mapOptions.center">
                    <ul>
                        <p *ngIf="data.value.lastReported"><strong>Last Seen: </strong>{{data.value.lastReported | date: 'dd/MM/yyyy HH:mm:ss'}}</p>
                        <p *ngIf="address.length>0"><strong>Address: </strong>{{address}}</p>
                    </ul>
                </map-info-window> 
            </google-map>
            <br>
        </div>
        <app-no-data *ngIf="!hasData" [title]="data.title"></app-no-data>
    </div>
</a>

{{data.title}
    上次查看:{{data.value.lastReported}日期:'dd/MM/yyyy HH:MM:ss'}

    地址:{{address}


我尝试过删除标记,删除地图信息视图,但它就是不起作用。有趣的是,你可以点击这张卡片在仪表板上加载一个完整的谷歌地图视图,效果很好

有什么线索吗

谢谢你的帮助

干杯, 维尼