Hi guys!
In my parent tpl I have info circles to which I add .color class in onRendered callback.
After some UI manipulations (eg choosing product category) a child tpl (with product details) is rendered into view. It also has info circles which need to have the same .color class.
Of course, I could add the same function to child tpl’s onRendered cb, but that wouldn’t be very DRY would it?
Q: how can I detect child tpl’s render event in parent tpl and call the same function on this render event? Or maybe you can propose a smarter solution altogether?
I have a meteorpad that shows this - as @Steve suggests uses a reactive data source and sets the class of already rendered elements and any that are added dynamically…
well, one example
{{> childTemplate color=parentColor }}
and than in childTemplate helper you can access it as this.color
I am not sure, maybe it affects data context somehow or replace it, test behaviour.
There was something strange happening but I have no time to test why yet.