0
我正在使用谷歌'空閒'事件監聽器來上傳地圖上的標記(使用angularjs)。我的代碼是停止谷歌地圖空閒事件監聽器
$scope.LoadSearchPropertyOnPortFolioSales = function (PropertyName) {
if(PropertyName == ''){
google.maps.event.addListener(map, 'idle', function() {
var PropertyList = PropertyService.GetSearchPropertyForPortfolio($scope.PortfolioId, $scope.PropertyName, this.center.lat(), this.center.lng(), 0.005, 0.005);
PropertyList.then(function (pl) {
DrawPropertyOnPortFolioSale(pl.data, $scope.PropertyName);
},
});
}
else
{
//Stop event listener
}
}
我希望事件偵聽器只有在傳遞的PropertyName沒有值時纔有效。但是當PropertyName有一些值時,我想停止事件監聽器。如何阻止事件監聽器......