我有一个表格和地图(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 });
重新加载该程序页面。
那也行不通。有谁可以帮助我