Kalashir
Kalashir

Reputation: 1127

Add custom icon on marker mapbox.js

Below is my draw marker code in which I want to add custom icon.

  drawMarker: function() {
    this.drawnItems.clearLayers();
    this.drawHandler = new L.Draw.Marker(this.map,this.drawControl.options.draw.marker);
    L.Draw.Marker.options.icon ="/assets/image/marker.png";
    this.drawHandler.enable();
},

But custom icon code is not working.

Upvotes: 0

Views: 305

Answers (1)

Kalashir
Kalashir

Reputation: 1127

I have just replaced below line

  this.drawHandler = new L.Draw.Marker(this.map, {icon:L.icon({iconUrl:'/assets/image/marker.png'})});

And it worked.

Upvotes: 1

Related Questions