1

I am using: >

ruler1 = new google.maps.Marker({
    position: map.getCenter() ,
    map: map,
    draggable: true
  });

to create a marker and then create and bind a label to it as below:

    ruler1label = new Label({ map: map });
    ruler1label.bindTo('position', ruler1, 'position');

However, when removing the marker by: ruler1.setMap(null) which removes the marker but leaves the label behind. I tried unbinding the label to remove it by ruler1label.setLabel(null); but it does not work. How can I remove these labels? I have appended a screenshot to make it clear.

enter image description here

0

1 Answer 1

1

Try ruler1label.setMap(null);. You don't have to bind/unbind, just calling that setMap on the label worked for me.

1
  • I had tried this, it did not work for me. Maybe there is some other issue with the code. Thanks for your reply.
    – Pixaanch
    Feb 16, 2018 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.