ng-repeat nh-include template
HTML
<div ng-app>
<script type="text/ng-template" id="foo">
<div ng:controller="FooCtrl">
<p>Foo: {{title}}</p>
</div>
</script>
<script type="text/ng-template" id="bar">
<div ng:controller="BarCtrl">
<p>Bar: {{title}}</p>
</div>
</script>
<div ng:controller="DashboardCtrl">
<div ng:repeat="chart in charts">
<ng:include src="chart.template"></ng:include>
</div>
</div>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<script src="http://docs.angularjs.org/angular-1.0.0.min.js"></script>
<style>
JavaScript
function DashboardCtrl($scope) {
$scope.charts = [
{ template : 'foo', title : 'f1' },
{ template : 'foo', title : 'f2' },
{ template : 'bar', title : 'b1' }
];
}
function FooCtrl($scope) {
$scope.title = $scope.chart.title;
}
function BarCtrl($scope) {
$scope.title = $scope.chart.title;
}