、そのうちの一つは、子セクションの親セクションの配列や他を初期化することができます。子供はその親が誰であるかについての知識を保持するだろう。
は、ここで作業plunkerを参照してください:Demo
2個のアレイ:
$scope.section = [{id: 1}, {id:2}];
$scope.subSection = [{id:1, parentId: 1}, {id:2, parentId: 1},{id:3, parentId: 2}];
ビュー:Devのワン@
<div ng-repeat="parent in section">
<span>Section {{parent.id}}</span>
<pre>
<div ng-repeat="child in subSection" ng-if="child.parentId == parent.id">
<span>SubSection {{child.id}}</span>
</div>
<button ng-click="addSubSection($index + 1)">Add SubSection</button>
</pre>
</div>
<button ng-click="addSection()">Add Section</button>
感謝を。ほんとうにありがとう。これは私が探しているものです。 – jamcoder