I am trying to use polylines on ngx-leaflet but i'm having some issues. First of all, I try to declare a polyline by passing a hardcoded latlng value it all works, but if I try to pass a variable ti gives me the following error:
bubu = [[39.838128, 15.480699]];
route= polyline([[39.838128, 15.480699]]); // ok
routes= polyline(this.bubu); /*Argument of type 'number[][]' is not assignable to parameter of type 'LatLngExpression[]'.
Type 'number[]' is not assignable to type 'LatLngExpression'.
Type 'number[]' is not assignable to type 'LatLngLiteral'.
Property 'lat' is missing in type 'number[]'.*/
I've also tried to use the setLatLngs method to update the coordinates dynamically but it does not accept Marker[] as coordinates:
markers: Marker[] = [];
marker.push(/*a valid marker*/);
marker.push(/*a valid marker*/);
route= polyline( markers); /*: Argument of type 'Marker<any>[]' is not assignable to parameter of type 'LatLngExpression[]'.
Type 'Marker<any>' is not assignable to type 'LatLngExpression'.
Type 'Marker<any>' is not assignable to type 'LatLngLiteral'.
Property 'lat' is missing in type 'Marker<any>'.
*/
So I can I dynamically create a polyline and update with the library? The final purpose i'm trying to build is that the final user has the feature of creating markers and link them with polylines.
I want to make clear that i'm using only the standard 'ngx-leaflet' lib and not the others plugin.