How to open dynamically a template inside a template


#1

I’m working on an Ionic-tabs-app for iPad.
In one of my templates i got on the left side a dynamic generated tree.
When i click on an item i want to open on the right side another template in which elements (labels and textboxes) shall be generated out of data which was read from a database according to the id of the clicked treeview item.
First i tried to load the template inside a div-element, but in that case the template has no reference to it’s controller because i couldn’t use a state.
I loaded the template like this:

    var panel_dynamic = document.getElementById('panel_dynamic');
    if (panel_dynamic.hasChildNodes()) {
        panel_dynamic.removeChild(panel_dynamic.childNodes[0]);
    }
    var line = document.createElement("div");
    if(item.id == 9999)
    {
        $.get("templates\\type-of-test.html?Param=" + item.id, function (response) {
            line.innerHTML = response;
        });
        panel_dynamic.appendChild(line);
    }

I have read meanwhile that this could be done with ng-include.
But is it possible when i want to open not just one template but different ones according to the clicked treeview item?
Attention: I got different templates and controllers.

Thanks in advance!