Search code examples
javascriptarraysangularjsmaterialize

angular ng-repeat display value from array inside an array


I'm new with angular, and I m trying to build a dynamic pricing table

I have this :

    <li ng-repeat="option in optionsActives"  class="collection-item {{option.categorie}}"><div>{{option.services}}<a class="secondary-content"><i class="material-icons">done</i></a></div></li>

output : [{"titre":"titre","desc":"description"},{"titre":"titre a","desc":"description a"}]

But I need to output {{option.services.descr}}

Here's my fiddle https://jsfiddle.net/shutterlab/vnss3mf0/3/

I would like to display value inside services array (array inside items) but I can get the value from {{option.services.titre}} {{option.services.descr}} Inside a ng-repeat ?

What can i do ?

thanks a lot for your help


Solution

  • In Angular you can nest ng-repeat's

    You simply do:

    <div ng-repeat="optionItem in option.services">{{ optionItem.desc }}</div>
    

    I've updated your fiddle:

    https://jsfiddle.net/vnss3mf0/4/