The task is to programmatically pop up messages at the markers on the map without disturbing the logic of their work. One of the ways I know of me is to put the marker in focus:

$scope.markers['m1'].focus = true; 

However, when you click on a marker with a mouse, this property does not change automatically - which disrupts the operation of a program call.

Since the events are raised in the following order:

  1. leafletDirectiveMap.popupopen
  2. leafletDirectiveMarker.click

and when the FOCUS value changes in the click handler, the popup closes immediately, I see two ways to solve this problem:

1 - Get the marker in the window creation handler (I did not find any hint in the parameter of the handler for the popup-related marker) 2 - Change the FOCUS value when clicked, but avoid invoking change-handlers. But in terms of the implementation of these 2 ideas, no thoughts so far. Here is the simplest code for an example:

 var app = angular.module('demoapp',['leaflet-directive']); app.controller('DemoController', [ '$scope', 'leafletData', function($scope, leafletData) { angular.extend($scope, { center: { lat: 59.91, lng: 10.70, zoom: 5 }, markers: { m1: { lat: 58.91, lng: 10.75, message: "<popup></popup>", //directive focus: false }, m2: { lat: 57.91, lng: 10.95, message: "<popup></popup>", //directive focus: false } }, }); $scope.$on('leafletDirectiveMap.popupopen', function(e, args){ //GET POPUP MARKER! }); $scope.$on('leafletDirectiveMarker.click', function(e, args){ //$scope.markers[args.modelName].focus = true; }); }]); 

    0