Is it possible to use ng-repeat (given the data source below) to create the following DOM structure?
JS
scope.data = ['a', 'b', 'c', 'd']; // The size of this array varies
HTML output
<div class="a">
<div class="b">
<div class="c">
<div class="d">
</div>
</div>
</div>
</div>
I don't want to change the data source, and I have also tried playing ng-repeat-start and ng-repeat-end to no avail. I was thinking that perhaps I could use multiple ng-repeat instances (one to create the opening tag and the other to create the closing tag) but am not sure how I could implement this.
Would I need to write a custom directive for this?
UPDATE The solution described by sylwester only works if you know the size of the data array, however I am interested in a solution that renders the required divs based on a indeterminate array length.