explooosion / Agm-Direction

This is the directive for @agm/core (not official)
https://robby570.tw/Agm-Direction-Docs/
MIT License
75 stars 26 forks source link

How to save way points #22

Closed henoktsegaye closed 6 years ago

henoktsegaye commented 6 years ago

by the way i want to say that is a really good thing you done out there , i was wondering how to save a way points after some body drags the direction cause we don't want to start fresh next time , we wanted to show the way points he /she dragged

explooosion commented 6 years ago

Hi @henoktsegaye !

When he/she drags the direction, you can get the information from (onChange) event. The event's payload likes the following picture:

Payload

image

request

The new event's payload, so you can save these waypoints.

Example:

HTML

<agm-map>
<agm-direction ... [waypoints]="waypoints" (onChange)="dirChange($event)"></agm-direction>
</agm-map>

TS

waypoints: any = [];
dirChange(event: any) {
    console.log(event);
    this.waypoints = event.request.waypoints;
}