0

I am making a dynamic permissions list, how would I go about using the "item" from:

<div *ngFor="let item of PermissionsList.T1">
  <!-- Some code here -->
</div>

in a inner ngFor loop. I have tried the following, and other similar variations:

<p *ngFor="let item2 of PermissionsList.{{item}}">test</p>

The PermissionsList example is like this:

T1: Array [ "Business", "Recreation", "Vehicles" ]

Recreation: Array [ "Hunting", "Leisure" ]

Hunting: Array [ "Big_Game", "Bird", "Pest" ]

Big_Game: Array [ "Moose", "Elk" ]

​Pest: Array [ "Wild Boar", "Fox" ]

Bird: Array [ "Geese", "Sharp-tailed grouse" ]

​Leisure: Array [ "Hiking", "Bird Watching" ]

Business: Array [ "Trapping", "Utility", "Construction"]

Vehicles: Array [ "Half_ton", "ATV", "SnowMobile" ]

1
  • Use PermissionsList[item] instead of PermissionsList.{{item}} Commented Sep 17, 2020 at 20:54

1 Answer 1

1

If PermissionsList is an Array of Arrays and you mean to iterate on the second arrays you can try this:

<div *ngFor="let permission of PermissionsList">
  <div *ngFor="let item of permission ">
    {{ item }}
  </div>
</div>

If PermissionsList is an Object of Arrays and you just want to display T1 for example, try this:

<div *ngFor="let t1 of PermissionsList['T1']">
  {{ t1 }}
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

Your'e Welcome ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.