Javascript in template


I’m trying to dynamically load different views into a template view through the user clicks on buttons. I’ve defined the buttons and have tied them into functions triggered by click events. The functions look like:

function one(){

I am able to load the html file into the template and view it, but the javascript that was in the template does not get invoked. Is it possible to run the javascript from a template loaded file? I would like to do this so that I can create a file that can include your other views like so:

/* test.html */
           .......... view goes here such as form, accordian, etc.

Can this be done or should I be doing it via another method?


While there is no way to evaluate js during html template loading, there is a way to load ui config dynamically.

Check , in latest package

In most cases, instead of ui reloading it may have sense to use “multiview” element and just switch visible view.

I would actually prefer to use the multiview, but I cannot find how to add and remove cells dynamically. I want to minimise the onload footprint and also want to make sure that as more cells are loaded, we do not crash the browser. Any chance you have a sample for dynamically creating and destroying cells in the multiview?

Thanks again!