Thank you very much concerned about this issue, this problem is angular child scope not inherited from the parent scope when I use the transclude directive, this issue has a relationship with angular.js versions before 1.2.17 can work release, version 1.2.18 after are ineffective
These are two versions of the actual test results. http://jsfiddle.net/a3ywb2c4/
var App= angular.module("myApp",[]);
App.controller("testCtrl",function($scope){
$scope.names= [{name:"janry",value:123},{name:"janry",value:123},{name:"janry",value:123}]
$scope.dd="hello world"
});
App.directive("testDire",function($parse){
return {
restrict:'A',
transclude:true,
template:"<div ng-repeat='$item in $items' ng-transclude></div>",
scope:false,
link:function(scope,iele,attrs,ctrl,transclude){
var getter=$parse(attrs.data)
scope.$items = getter(scope);
}
};
})
This is how AngularJS is built: the scope for the transcluded directive is a sibling of the container directive, and they both inherit the parent scope.
This post has very good explanations and work arounds.