How to replace the slotted elements


I have a polymer template which has slot, and the scenario is that I might need to replace the slot elements based up on the url parameters when navigating. I am wondering whether there are server-side element apis to allow me to replace with the new elements and garbage-collect those replaced elements.

Best regards,

First remove the old Component and just use add(component) normally to add the new one. Set the slot using component.getElement().setAttribute("slot", slotName).
Garbage collection should work as usual.