Creating a dynamic list from a 2D array (Angular)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Creating a dynamic list from a 2D array (Angular)



I'm trying to figure out how to make a ul of items from a 2D array.
I have a 2D array. I'm trying to implement a UL where each IL is a separate row from the 2D array. The 2D array is retrieved from service.ts. Then the service delivers the 2D array to a component via a subscriber. I'm not to sure how to go about this. The idea is depicted below:



Object.




1 Answer
1



The array you get from service.ts, make sure you assign it to a field inside you *.component.ts file. Then in your component.html file, you can iterate over this array with an *ngFor


service.ts


*.component.ts


component.html


*ngFor



E.g


<ul>
<li *ngFor="let row of array">{{row}}</li>
</ul>






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results