var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
});
app.directive('test', function(){
return {
transclude: true,
restrict: 'E',
template: '<div ng-repeat="item in collection"> <div ng-transclude> </div> </div>',
compile: function compile(tElement, tAttrs) {
return {
pre: function preLink(scope, iElement, iAttrs, crtl, transclude) {
scope.collection = [1, 2, 3, 4, 5];
},
post: function postLink(scope, iElement, iAttrs, controller) {
}
};
}
};
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.2.x" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js" data-semver="1.2.18"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<p>ng repeat into transclude issue</p>
<test>
<h3>- number: {{item}}</h3>
</test>
</body>
</html>
/* Put your css in here */