I use a template that generates a Bootstrap tab layout. Like below:
Use ng-include
with $templateCache
rather than ng-repeat
. For example:
var app = angular.module('foo', []);
function foo($templateCache)
{
var model =
{"data":
[
{"name": "Stack",
"desc": ["Exchange", "Overflow"]
}
]
},
cursor, i, bar = baz = "";
for (i = 0; i < model.data.length; i++)
{
bar = bar.concat("<li>", model.data[i].name,"</li>");
baz = baz.concat("<li>", model.data[i].desc.join().replace(/,/g,"</li><li>") );
}
$templateCache.put('name', bar);
$templateCache.put('desc', baz);
}
app.run(foo);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="foo">
<ul ng-include="'name'"></ul>
<ul ng-include="'desc'"></ul>
</div>
References
Tweak the Angular Test by Controlling the Template
AngularJS in a Groovy World
AngularJS Source: templateRequestSpec.js
AngularJS Source: ngIncludeSpec.js