angularagm-direction

Why am i getting InvalidValueError: in property origin: must set one of location, placeId or query error in angular?


In my angular10 app i am using agm core to show google maps.

component.html

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

component.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)
 }
}

Now map is showing and direction is also showing on map correctly but i am getting this error on console

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

Solution

  • try to use source: any ; without any {} obj mapping This one solve my problem