I am working an application in which I created a static JSON object array which contains parent child data. I am showing that data into dropdown list what I want to achieve here is I have different records whose status will be different like completed, cancelled or others. I just to show or hide options from dropdown list using these statuses. Here is my JSON code.
export const projectCardVerticalDropdown = [
{
nameSub: 'Information',
children: [
{
icon: 'i-expand',
name: 'See Expanded Project',
code: 1,
},
],
},
{
nameSub: 'Schedule',
children: [
{
icon: 'i-plus',
name: 'add a new task',
code: 2,
},
{
icon: 'i-calendar-week',
name: 'see schedule',
code: 3,
},
],
},
{
nameSub: 'Project Templates',
children: [
{
icon: 'i-copy-1',
name: 'Clone Project',
code: 4,
},
{
icon: 'i-project_stage_initiation',
name: 'Make Template From Project',
code: 5,
},
{
icon: 'i-recieved_files2',
name: 'Apply Template to this Project',
code: 6,
},
],
},
{
nameSub: 'Data',
children: [
{
icon: 'i-file-invoice-1',
name: 'see Proposal',
code: 7,
},
{
icon: 'i-images',
name: 'See Project Photos',
code: 8,
},
{
icon: 'i-mail_attachment',
name: 'See Project Files',
code: 9,
},
],
},
{
nameSub: 'Edit',
children: [
{
icon: 'i-check_mark',
name: 'mark project complete',
code: 10,
},
{
icon: 'i-edit',
name: 'Edit Project Details',
code: 11,
},
],
},
];
Here is my Html and ts Code
verticalDropDownListData = projectCardVerticalDropdown;
<div class="f-column" *ngFor="let item of verticalDropDownListData">
<span class="hr">
<small class="">{{item.nameSub}}</small>
</span>
<button data-testid="project-card-expand" class="no-border"
(click)="selectedProjectInfo(project)" *ngFor="let items of item.children"
(click)="selectedDropdownListData(items.code,cloneModal, project)">
<i class="{{items.icon}}"></i>
<span>{{items.name}}</span>
</button>
</div>
I need to add check to show or hide options in JSON object array.