What I'm trying to do is create a DOM node, display the template with ko.renderTemplate, overwriting the created node, and then, in this template, both will be able to get data from a specific model and from viewModel $ root.
Example:
var data = new ModelData();
var domNode = document.createElement("div");
document.body.appendChild(domNode);
ko.renderTemplate('template', data, {}, domNode, 'replaceNode');
And the template might look like this:
<script type="text/html" id="template">
<span data-bind="text: DataFromModel"></span>
<ul data-bind="foreach: $root.DataFromViewModelRoot">
</ul>
</script>
In this case, I do not get any data from $ root.DataFromViewModelRoot, because it believes that $ root-data is ModelData (and I understand why, I just don't know how I should do this).
, , , () , , ". , DOM node.