title: How to fix marker in center of leaflet map after user will drag the map?
body: <p>I am using a custom map on my node add form. My marker is set to my current location using lat and log. Now I want, whenever a user will drag or move map, marker should be in center (fixed). I tried lot of things like:</p>
  <pre class="lang-js prettyprint-override"><code>$cordovaGeolocation.getCurrentPosition(options).then(function(position) {
      $scope.latlong = position.coords.latitude + &quot;,&quot; + position.coords.longitude;
      $rootScope.lati= position.coords.latitude ;
      $rootScope.long = position.coords.longitude;
  
      $scope.map.center = {
          lat: position.coords.latitude,
          lng: position.coords.longitude,
          zoom: 20
      };
  
      $scope.map.markers.now = {
          lat: position.coords.latitude,
          lng: position.coords.longitude,
          message: &quot;Usted esta aqui!&quot;,
          draggable: false,
          focus: true
      };
  
      if ($rootScope.locationresults == undefined) {
          Util.getAddressOf(position.coords.latitude, position.coords.longitude).then(function(location) {
              $rootScope.locationresults = location[0].formatted_address;
              console.log(location);
          }, function(error) {
              console.error(error);
          });
      }
  
      $scope.$on(&quot;leafletDirectiveMap.move&quot;, function(event, args) {
          $scope.map.markers.now.setLatLng([0,0]).update();
          //$scope.map.markers.now.lat = $scope.map.center.lat;
          //$scope.map.markers.now.lng = $scope.map.center.lng;
          console.info(JSON.stringify($scope.map.markers.now));
      });
  
      $scope.$on(&quot;leafletDirectiveMap.drag&quot;, function(event, args){
          console.log(JSON.stringify($scope.map.center));
          //$scope.map.markers.now.setLatLng(0,0);
          $scope.map.markers.now.lat = $scope.map.center.lat;
          $scope.map.markers.now.lng = $scope.map.center.lng;
  
      });
  
      $scope.$on(&quot;leafletDirectiveMarker.dragend&quot;, function(event, args) {
          console.log(&quot;moviendo&quot;);
          $rootScope.lati= args.model.lat ;
          $rootScope.long = args.model.lng;
          Util.getAddressOf(args.model.lat, args.model.lng).then(function(location) {
              $rootScope.locationresults = location[0].formatted_address;
              $scope.latlong = args.model.lat + &quot;,&quot; + args.model.lng;
              console.log(location);
          }, function(error) {
              console.error(error);
          });
      });
  }, function(error) {
      console.log(error);
  });
  </code></pre>