How can I destroy dynamically created layers?I am trying to call layer.destroy() on a click handler, but I don't think the layer is available in the scope.
The coffeescript experts in the group will have a better answer but this is working for me (basically overwriting a global variable)
^this is correct
You can indent the btn event, and it'll work
Probably the better longterm fix is to create the modal as btn.modal, and then the modal will be in scope, and you can use this.modal.destroy(), or you can use btn.modal.destroy() whatever you want to do.
Thanks for all the help!