我正在制作一个动态权限列表,我将如何使用来自以下的“项目”:
<div *ngFor="let item of PermissionsList.T1">
<!-- Some code here -->
</div>
在一个内部ngFor
循环中。我尝试了以下和其他类似的变体:
<p *ngFor="let item2 of PermissionsList.{{item}}">test</p>
这个PermissionsList
例子是这样的:
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" ]