I created a template in which I dynamically want to render another template (which was registered for a particular type in some other place of the application).
Template:
<template name="renderField">
{{#if field.type}}
<!-- a custom rendering is requested - this will be made visible onRendered-->
<div class="field">
</div>
{{else}}
...
{{/if}}
</template>
Once the enclosing “renderField”-template is rendered, I wanted to render the custom template.
import { Template } from 'meteor/templating';
Template.renderField.onRendered(function() {
console.log('onRendered');
const field = this.data;
if (field.type && renderers[field.type]) {
Blaze.renderWithData(Template[renderers[field.type]], field, this.find('.field'));
}
});
However, the onRendered-function is never executed.
I verified on the frontend, that Template.renderField._callbacks.rendered[0]
contains the callback.
What am I missing?
| => meteor --version
Meteor 1.6.0.1