ngRepeat with ngInclude template
by yoorek
HTML
<div ng-controller="MyCtrl">
<div ng-repeat='template in inner' ng-include='template'></div>
Value of scope.inner = {{inner}}
</div>
<script type="text/ng-template" id="one">
<div class="one"></div>
</script>
<script type="text/ng-template" id="two">
<div class="two"></div>
</script>
JavaScript
var myApp = angular.module('myApp', []);
myApp.directive('one', function() {
return {
restrict: 'C',
template: '<div>Directive one</div>'
}
});
myApp.directive('two', function() {
return {
restrict: 'C',
template: '<div>Directive two</div>'
}
});
function MyCtrl($scope) {
$scope.inner = ["one","two"];
}