How to destroy a dynamically rendered template?

Hello! I have a parent template called “parent” and a bunch of child templates that are rendered inside parent,

<template name="parent">
    <div id="unique-id">
    {{> Template.dynamic template=currentScreen }}

I render parent dynamically as well by using:

templateID = Blaze.renderWithData(Template.parent, { _id: id, screen:['template1', 'template2', 'template3'] }, $(body)[0]);

// currentScreen is a helper function that will return a value from screen array

I can destroy the parent template by:


but this doesn’t trigger Template.template1.onDestroy. so my question is how can trigger it or manually destroy a child template?

thanks in advance :slight_smile: