agm-polygon path is not getting updated on changes in component.ts file

96 Views Asked by At

<agm-polygon [paths]="paths" [clickable]="false" >

Before changing path:

paths = [
  [{ lat:  51.673858,  lng:  7.815982 ,label:"Node1"},
  { lat: 51.373858,  lng: 7.215982,label:"Node2" }],[
 
  { lat:  51.673858,  lng:  7.815982, label:"Node2"},
  { lat:  51.723858,  lng:  7.895982 ,label:"Node3"},]
]

The path is getting updated only once after initialization in . when I tried to update courses on click of marker to a different one.

 <agm-marker (markerRightClick)="onRightClickMarker(m)"></agm-marker>

the path is changing correctly in .ts which is a component file, but it is not getting updated in the template.

After changing paths:

paths = [
  [{ lat:  31.673858,  lng:  5.815982 ,label:"Node1"},
  { lat: 31.373858,  lng: 5.215982,label:"Node2" }],[
 
  { lat:  31.673858,  lng:  5.815982, label:"Node2"},
  { lat:  31.723858,  lng:  5.895982 ,label:"Node3"},]
]

Here is a stack blitz Example : https://stackblitz.com/edit/agm-angular-google-map-cedfud?file=app%2Fapp.component.ts,app%2Fapp.component.html

0

There are 0 best solutions below