Closed P1X3 closed 6 years ago
Okay, so going to answer my own question.
this.onChange.emit(response);
this.directionsDisplay
and calling setMap
method on it.
this.directionsDisplay.addListener('directions_changed', () => {
this.onChange.emit(this.directionsDisplay.getDirections());
});
So now onChange is fired when directions are changed in the Renderer, and that includes dragable routes.
Hi @P1X3 . Thanks for your suggestion, I will add this feature 😃.
Version 0.5.4 Now Available.
Would love to get some input and help with adding directions_changed listener. However, I can't comprehend how to connect it all. I have added the code pasted below right after
directionsDisplay
is initialized, but the problem is that neither onChange or directionsDisplay are defined inside listener function. Obviously...So my temporary workaround was to create additional EventEmitter outside of AgmDirection class, then subscribe to it in ngOnInit, and finally from there just emit onChange with directionsDisplay.getDirections(). Kind of a tacky but it works. If dragable is set to true then after dragging route will fire onChange with modified route.
Would love to know what would be the proper way to do this and perhaps it can be added to project.