Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : How to remove controllers without deleting the parent Element?

$
0
0
So what exactly are you trying to do. What do you mean you want to "exchange" widgets?

You can remove the element from the DOM, which will also destroy the Control instance. Or, if you want to keep the element in the DOM, you can call destroy on the Control instance to remove the bindings.

If you are rendering HTML in the Control's element within your widget, you will have to override the destroy method to clear this out. Destroy only removes bindings and clears references to the control instance so it can be garbage collected. It cannot know what other DOM modification you have done, so it is up to you to clean those up/.



Viewing all articles
Browse latest Browse all 3491

Trending Articles