Is it possible to assign an alias to a long reference name in ng-repeat?
Currently, I have 2 complex objects where one acts as a grouped index for the other. Although the ng-repeat template code is functioning correctly, it's getting hard to read and maintain, especially considering revisiting it in the future.
If feasible, how can I transform the following structure:
<div ng-repeat="a in apples">
<div>
<span>Type</span>
<span>{{a.category[1].information.type}}</span>
</div>
<div>
Don't you just love <span>{{a.category[1].information.type}}</span> apples.
My granny says {{a.category[1].information.type}} apples are the best kind.
I would pick {{a.category[1].information.type}} over {{apples[0].category[1].information.type}} apples any day of the week.
</div>
</div>
to something like this:
<div ng-repeat="a in apples"
ng-example-assign="ta = a.category[1].information.type">
<div>
<span>Type</span>
<span>{{ta}}</span>
</div>
<div>
Don't you just love <span>{{ta}}</span> apples.
My granny says {{ta}} apples are the best kind.
I would pick {{ta}} over {{apples[0].category[1].information.type}} apples any day of the week.
</div>
</div>
The use of ng-example-assign
directive was created for illustration purposes. Can anyone confirm if such functionality is achievable with Angular or ng-repeat? It might require a reevaluation of the code structure, but I wanted to inquire here first. Thanks in advance!