I am trying to iterate over a JSON object userTypes
.
For the below code:
In the 1st ng-repeat:
{{user.type}}
outputs 'Parent'(as expected),
{{user.options}}
outputs '[{"option1":"11QWERT","option2":"22QWERT"}]'(as expected).
But in the 2nd ng-repeat
, I am not able to iterate through the user.options
and output each of the {{options}}
What should be changed to get the option1
and option2
as the outputs in 2nd ng-repeat
?
JS snippet
var userTypes = [{
"type": 'Parent',
"options": [{
"option1": "11QWERT",
"option2": "22QWERT"
}]
}]
HTML snippet
<li ng-repeat="user in userTypes">
<p>{{user.type}}</p>
<p>{{user.options}}</p>
<li ng-repeat="option in user.options">
<p>
{{option}}
</p>
</li>
</li>