I am facing an issue where I have a nested ng-repeat directive. I am attempting to create a dynamic second ng-repeat, using a key from the first one, but the current syntax is not working. Is there a different way to achieve this? Perhaps a different notation?
<div class="entry" ng-repeat="(key, choice) in choices">
<div >
<div ng-repeat="option in fields['user_' + key].options | filter : {v:choices[key].junior.v}" class="box-content-value">{{option.l}}</div>
</div>
</div>
The filter functionality works fine as it's an object, however fields.user_$
is not, and requires combining a string with a variable to function properly.
Note: 'choices' is simply an array of JavaScript objects and is not relevant for this query.
On the other hand, the structure of 'fields' is as follows:
"fields": {
"user_0": {
"display": true,
"options": [{
"k": 0,
"v": "",
"l": "Please select"
}, {
"k": 1,
"v": "male",
"l": "Male"
}, {
"k": 2,
"v": "female",
"l": "Female"
}],
"read_only": false
}
}
Hence, my goal is to display the full value of fields.options.l
based solely on its fields.option.v
property. This is why I am utilizing a filter in this scenario.