isChecked(name){
let tempI = this.chekcbOxValueArray.findIndex((x)=> x == name)
return tempI>=0 ?true :false;
}
selectedWorker(name, checked){
if(checked == true){
this.a.push(name)
}
}
onClickOkay(){
item.workerNamesSelected = a.toString()
}
<div class="accordion-content">
<div *ngFor="let item of accordianFields; let i = index">
<!-- This is 1st item of accordian (chekcbox input) -->
<div>
worker Names
<ng-template #checkBoxPopup>
<div *ngFor="let worker of workerdataList">
<input type="chekcbox" [checked]="isChecked(worker.name)"
(click)="selectedWorker(worker.name, $event.target.checked)"
[(ngModel)]="item.workerNamesSelected" />
</div>
<div>
<button (click)="onClickOkay"></button>
</div>
</ng-template>
<span ngbPopover="checkBoxPopup"></span>
</div>\
<!-- 2nd item -->
<!-- nth -->
</div>
</div>
I am unable to get value for each item of accordion. The value remains same for all the accordion item -worker name.
Expected result:
for 1st item : some selected worker
for second accordion item : some other selected worker
Aucun commentaire:
Enregistrer un commentaire