Angular - trying to create a category listing

Hello,

Subject: Angular, Array, Category, listing.

I can do this in PHP but can’t seem to wrap my head round as to how to achieve what I’m trying to do in Angular.

I’m trying to create a category listing something similar to a classified site listing.
example: Car (parent category)
– Ford (second level child category)
---- GM (third level child category)
– Honda
– etc.
objective:
Build the categories and display 3 to 4 categories cross the screen. If there are more then 3 or 4 categories display them below and keep building them until there are no more categories to display

you can find the example script at https://angular-xafyq5.stackblitz.io:

spent 3 weeks with nothing to show, any help you can provide would be greatly appreciated.

Hi @robin01,

There’s a blog post here that covers how to render a component recursively in Angular, so you can output tree structures like nested menus.

The other step is to get your data into the necessary structure. If you have the option of doing so, I recommend doing that on the server so that minimal (if any) manipulation is necessary on the client. If you don’t have that option, then you could use a small lib like flat-to-nested to take care of converting your array of colours to a tree.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.