Hi
I have a module example from the docs:
export const init = name => {
document.addEventListener('click', e => {
const someNode = e.target.closest('.block_es6_header');
if (someNode) {
alert('Hello ' + name + ' you clicked');
}
});
};
in a file user_form.js already grunted without error. No problem to use a renderer.php to make it work from there but how to call it from a template (since I eliminated the renderer now):
<div class="container">
<h3 class="{{headerclass}}">{{header}}</h3>
<div>
<ul class="list-group">
{{#studentlist}}
<li class="list-group-item list-group-item-warning">{{.}}</li>
{{/studentlist}}
</ul>
</div>
{{#js}}
require{['block_es6/user_form'], function(init)}
{{/js}}
</div>
I need to pass the {{name}} member of the template data object to the function init as well.
Thanks for any clarification.