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; }
<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>