How can i achieve this ?
ngFor listing item should change based on button click , which item status should be true
*ngFor="let project of projects | conditionListTrueItem "
Json example
projects :
{ name:'name one', status: {
ongoing: true,
completed: false,
incomplete: false,
}
},
{ name:'name two', status: {
ongoing: false,
completed: true,
incomplete: false,
}
},
{ name:'name three', status: {
ongoing: false,
completed: false,
incomplete: true,
}
}
html
<button>Ongoing </button>
<button>completed</button>
<button>incomplete</button>
<div class="table" *ngFor="let project of projects">
<p>{{project.name}}</p>
</div>
project.ts
ngOnInit() {
this.projectsService.getAllProjects().subscribe( response => {
this.projects = response;
})
}