我想用json数据量重复模板没有错误显示,结果只是显示不完整的html
这是我的代码
experiment.directive('groupsControl', function(){
return {
restrict: 'E',
replace: true,
transclude: false,
template: '<div class="left"><div ng-repeat="group in children"><section-control sections="group"/></div></div>',
link: function(scope, element, attrs) {
}
}})
.directive('sectionControl', function(){
return {
restrict: 'E',
replace: true,
transclude: false,
scope: { items:'=sections'},
template: '<div ng-repeat="section in items" ng-include="getIncludeFile(section)">'+
'</div>',
link: function(scope, element, attrs) {
scope.getIncludeFile = function(section) {
return '/Experiment_management_workspace/Experiment_management_project_angularJs/template/'+section + ".html";
}
}
}})
有我的模板
<div><h3>Category1</h3>
<div ng-app="experiment">
<ui>
<li><a>{{data1.data1}}</a></li>
<li><a>{{data1.data1}}</a></li>
</ui>
json数据
{"name": "test",
"children":[
{"data": "function4" },
{"data": "function4" },
{"data": "function4" }]}
我希望它会重复三遍,
但结果只显示“Category1”三遍,我很困惑,请帮忙