Javascript 使用google maps在多段线的起点和终点放置点
我尝试使用AgmCoreModule在angular4的google地图中应用多段线。我成功应用了多段线,但如何在多段线的起点和终点添加点 代码html:Javascript 使用google maps在多段线的起点和终点放置点,javascript,angular,google-maps,typescript,Javascript,Angular,Google Maps,Typescript,我尝试使用AgmCoreModule在angular4的google地图中应用多段线。我成功应用了多段线,但如何在多段线的起点和终点添加点 代码html: <div class="container"> <agm-map [latitude]="latitude" [longitude]="longitude" [scrollwheel]="false" [zoom]="zoom"> <ng-container>
<div class="container">
<agm-map [latitude]="latitude" [longitude]="longitude" [scrollwheel]="false" [zoom]="zoom">
<ng-container>
<agm-polyline [strokeColor]="color" [strokeWeight]="weight">
<agm-polyline-point *ngFor="let test of lines" [latitude]="test.latitude"
[longitude]="test.longitude" >
</agm-polyline-point>
</agm-polyline>
</ng-container>
</agm-map>
</div>
而typscript代码只是数组行和颜色
我不知道是否有一个特定的结构可以解决您的问题,但这是一个很好的解决方案
<div class="container">
<agm-map [latitude]="latitude" [longitude]="longitude" [scrollwheel]="false" [zoom]="zoom">
<ng-container>
<agm-circle [latitude]="lines[0].latitude" [longitude]="lines[0].longitude"
[fillOpacity]="0.5" [radius]="1000" ></agm-circle>
<agm-circle [latitude]="lines[lines.length - 1].latitude" [longitude]="lines[lines.length - 1].longitude"
[fillOpacity]="0.5" [radius]="1000" ></agm-circle>
<agm-polyline [strokeColor]="color" [strokeWeight]="weight">
<agm-polyline-point *ngFor="let test of lines" [latitude]="test.latitude" [longitude]="test.longitude" ></agm-polyline-point>
</agm-polyline>
</ng-container>
</agm-map>
</div>
请提供任何帮助。。。