There is a new DOM based template engine called soma-template there I can do this:
var tempDiv = document.createElement("div");
var str = "<div data-repeat='item in items'><div>{{$index}} - {{greet}} {{item.name}}!</div> </div>";
var template = soma.template.create(str,tempDiv );
template.scope.greet = "Hello";
template.scope.items = [
{ "name": "John" },
{ "name": "David" },
{ "name": "Mike" }];
template.render();
var finalHtmlStr = newDiv.innerHTML;
To retrieve the processed html string.
I tried achieving a similar result with using Angularjs (Is it possible to compile angular template to final html string?) but only managed to do it using a hidden element in the page.
Then I would have to wait for angular to render that elemente and retrieve its innerHTML.
I used the $viewContentLoaded event but that not very versatile.
Althought soma-template is great it is very young and lacks some futures I need.
Is the any way to put together a render() method like soma-template's using angular as the engine?
Thanks