Contenido del curso
Contenido del curso
José Nicolás Aristizabal Ramírez
David Fernando Rodriguez Delgado
Adrian Silva
David Higuera
una forma de lograr el mismo funcionamiento, pero con menos lineas de código sería la siguiente:
openFormCard(list: List) { if (this.boardDetail?.lists) { this.boardDetail.lists = this.boardDetail?.lists.map((listD) => ({ ...listD, showCardForm: listD.id === list.id, })); } }
Bonita ejecución
A mi me funcionó así:
openFormCard(listSel: List){ if(this.board?.lists){ this.board.lists.map(list => { list.id === listSel.id ? list.showForm = true : list.showForm = false; }) } }
Alternativa:
HTML
<div class="mt-5"> <app-btn *ngIf="activeFormList !== list.id" (click)="activeFormList = list.id" color="light" >Add Board</app-btn > <div *ngIf="activeFormList === list.id">active form</div> </div>
TS
activeFormList: List['id'] = '';