1

在我的angular10应用程序中,我agm core用来显示google maps

组件.html

<agm-map [latitude]="latitude" [longitude]="longitude">
  <agm-direction *ngIf="source && dest"  [origin]="source" [destination]="dest"></agm-direction>
</agm-map>

组件.ts

ngOnInit(){
 // above code...
 this.source = {
   lat: +(this.bidlocation.pickup.lat),
   lng: +(this.bidlocation.pickup.long)
 };
 this.dest = {
   lat: +(this.bidlocation.dropOff.lat),
   lng: +(this.bidlocation.dropOff.long)
 }
}

现在map正在显示并且direction也在map正确显示,但我正在接受error这个console

InvalidValueError: in property origin: must set one of location, placeId or query
4

1 回答 1

0

尝试使用 source: any ; 没有任何 {} obj 映射这个解决了我的问题

于 2020-12-20T17:06:48.027 回答