在我的项目中,我正在显示10条路线的地图。我对每个与agm-direction标签绑定的路由都称为“可见”标志。在按钮单击事件中,我将一些标志设置为false。有时通过隐藏标记== false的路由可以很好地工作,但在某些情况下不起作用。
<agm-map [styles]="mapstyles" [streetViewControl]="false">
<agm-direction *ngFor="let trip of planData.tripList [waypoints]="trip.waypoints" [visible]="trip.visible" [origin]="trip.origin" [destination]="trip.destination" [renderOptions]="{suppressMarkers: true, polylineOptions: { strokeColor: trip.hexColor }}">
<agm-marker [latitude]="trip.origin.lat" [longitude]="trip.origin.lng">
<agm-info-window isOpen="true">
Depot
</agm-info-window>
</agm-marker>
<div *ngIf="trip.showMarkers">
<agm-marker class="marker" *ngFor="let marker of trip.markers" [latitude]="marker.latitude" [longitude]="marker.longitude">
<agm-info-window>
{{marker.customerName}}
</agm-info-window>
</agm-marker>
</div>
</agm-direction>
</agm-map>