title: Add a dragable marker after geocoder result in Mapbox GL JS
body: <p>I'm trying to add a dragable marker after a geocoder result in Mapbox GL JS and set up a <code>dragend</code> event. I need this so the user can drag the marker in the exact location he wants.</p>
  
  <p>This is the tutorial I've followed: <a href="https://docs.mapbox.com/mapbox-gl-js/example/point-from-geocoder-result/" rel="nofollow noreferrer">Set a point after Geocoder result</a></p>
  
  <p>With this tutorial I could add the marker with the dragable option, but I don't know how I can add the <code>dragend</code> event to the marker.</p>
  
  <pre><code> var geocoder = new MapboxGeocoder({
        accessToken: Mapboxgl.accessToken,
        language: 'pt-BR',
        marker: {
          draggable: true,
          color: 'red'
        },
        placeholder: 'Pesquise por cidade, rua, bairro ou CEP',
        mapboxgl: Mapboxgl
    });
  </code></pre>
  
  <p>I tried creating a marker and setting it to the marker property, but without success:</p>
  
  <pre><code>const marker = new Mapboxgl.Marker({      
    draggable: true
  });
  
  marker.on('dragend', () =&gt; {
    console.log(marker.getLngLat());
  });
  
  var geocoder = new MapboxGeocoder({
    accessToken: Mapboxgl.accessToken,
    language: 'pt-BR',
    marker: marker,
    placeholder: 'Pesquise por cidade, rua, bairro ou CEP',
    mapboxgl: Mapboxgl
  });
  </code></pre>
  
  <p>Any ideas how can I solve this problem?</p>