如何在 Ngmap 中隐藏或删除动态添加的标记

How to hide or remove dynamically added marker in Ngmap

我有一个表格和地图(ngMap),填写表格并在地图上插入标记后,如果我单击提交,它将保存。但如果我再添加一个,标记将已经在先前坐标的位置。如果我手动重新加载页面,标记将离开地图。如何在不手动重新加载页面的情况下删除或隐藏。
HTML

  <ng-map zoom="13" center="{{coordinates.lat}},{{coordinates.lng}}" map-type-id="TERRAIN">
                    <marker></marker>
                    <shape name="polygon" on-click="drawPolygon()" paths={{rectangle}} stroke-color="#ff3232" stroke-opacity="0.8" stroke-weight="2" fill-color="#ff4c4c" fill-opacity="0.35">
                    </shape>
                    <drawing-manager on-overlaycomplete="insertMarker()" drawing-control-options="{position: 'TOP_CENTER',drawingModes:['marker']}" markerOptions="{icon:'http://www1.durban.gov.za/beachwater/images/markers/orange-dot.png'}" drawingControl="true" drawingMode="null">
                    </drawing-manager>
                </ng-map>


控制器

    $scope.drawingControlOptions = {
        position: 'TOP_CENTER',
        drawingModes: ['polygon', 'marker']
    };
    $scope.placesCounter = 0;
    $scope.insertMarker = function(e) {
        if (e.type == google.maps.drawing.OverlayType.MARKER) {
            $scope.placesCounter++;
            if ($scope.placesCounter > 1)
                e.overlay.setMap(null); //disable marker from diplaying ..
            var pos = e.overlay.getPosition();
            $scope.markercoordinates = pos.toString();
        }
    };

而且我也曾尝试过这样的成功承诺,但没有奏效

$scope.positions= [];
place.coordinates=$scope.positions[0];

因为我使用了 ui-router,所以我尝试像这样以编程方式重新加载页面 $state.transitionTo('dashboard.places.list', null, { reload: true, inherit: false, notify: true });
那也没有用。谁能帮帮我

github 中对此进行了讨论,并且此问题已在 ngMap 1.17.1 版中得到解决。