I have a main checkbox which has ngModel value as [(ngModel)]="formModel.acknowledged1" and on component it is set to false like formModel = { acknowledged1 :false }
and i have a table with n number of rows, each row having checkboxes associated with ngModel as [(ngModel)]="formModel.acknowledged1" so when i click on main checkbox, all checkboxes on tables get selected and then my function deleterow gets executed, but i want if i select only singly checkbox from table rows, then some other function should get executed. see below to make my question clear. html -
<p>
<checkbox [(ngModel)]="formModel.acknowledged1" id="box1" name="acknowledgement1"></checkbox></p>
<tbody infiniteScroll
[infiniteScrollDistance]="2"
[infiniteScrollThrottle]="300"
(scrolled)="onScroll()"
[scrollWindow]="false">
<ng-container *ngFor="let data of allData>
<tr class= "row-break">
<checkbox [(ngModel)]="formModel.acknowledged1" id="box2" name="acknowledgement2">
</checkbox>
<td>
<a></a>
</td>
<td>
</td>
</tr>
</ng-container>
</tbody>
component.ts -
export class CodesComponent implements OnInit{
formModel = {
acknowledged1 :false
}
ngOnInit (){
deleterow(){
if(this.formModel.acknowledged1==true){
this.reasonCodesActions.deleterow();
}
deletesinglerow(){
}
}
Aucun commentaire:
Enregistrer un commentaire