Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70432

*ngfor for nested arrays?

$
0
0

@alexmehler wrote:

hi,
i have an arry with subarrays:

let xxx = [

{

    country: "germany",

    cities: [

        "berlin",

        "munich"

    ]

},

{

    country: "germany",

    cities: [

        "berlin",

        "munich"

    ]

}

]

now i want to list only the cities in a list not the country … ngfor doesnt seem like a good fit for that

so my two options are :

  1. ditch ngfor and just populate the list with two nested for loops and create the ion-items on the fly with vanilla javascript

or

create anotehr array with the same two nested for loops and use that array for ngfor , but then it will be quite hard to get the actual array data on the original array for each list entry with a click listener , which is otherwise easy

if anyone got a better idea or an angular specific solution for this please share

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>