How can I avoid nested use of `ng-repeat`?
Sometimes I have to work with strange JSON objects from clients where I need to nest multiple times ng-repeat
.
Is there a way to handle this in one step? Perhaps something likeng-repeat="item in items in evenMoreItems"
Example:
<div ng-repeat="candle in candles">
<div ng-repeat="object in candle ">
{{ object.name }}
</div>
</div>
+3
source to share
1 answer
You can use the underline feature to smooth your data so that it fits better. see http://underscorejs.org/#flatten for example ..:
_.flatten([1, [2], [3, [[4]]]]);
=> [1, 2, 3, 4];
With a bit of data manipulation, you should be able to get a simple array to use sg-repeat.
+2
source to share