**Here is my code**
<td>
<label class="col-md-2">
<input type="checkbox" class="form-control" [ngModel]="row.create" name="create" [checked]="(row.create==='Y')" (change)="onChecked(operation, appName, 'create', $event.target.checked)">
</label>
<label class="col-md-2">
<input type="checkbox" class="form-control" [ngModel]="row.read" name="read" [checked]="(row.read==='Y')" (change)="onChecked(operation, appName, 'read', $event.target.checked)">
</label>
<label class="col-md-2">
<input type="checkbox" class="form-control" [ngModel]="row.exportFile" name="exportFile" [checked]="(row.exportFile==='Y')" (change)="onChecked(operation, appName, 'exportFile', $event.target.checked)">
</label>
<label class="col-md-2">
<input type="checkbox" class="form-control" [ngModel]="row.exportData" name="exportData" [checked]="(row.exportData==='Y')" (change)="onChecked(operation, appName, 'exportData', $event.target.checked)">
</label>
</td>
**Here is component.ts**
private onChecked(operation:any, appName: any, checked:boolean){
let appaccess = this.appData.find(
appaccess=>appaccess.appName===appName
);
let cbindex = this.appData.indexOf(appaccess);
if(checked){
switch(operation)
{
case 'create':
this.appData[cbindex].create = 'Y';
break;
case 'read':
this.appData[cbindex].read = 'Y';
break;
case 'exportFile':
this.appData[cbindex].exportFile = 'Y';
break;
case 'exportData':
this.appData[cbindex].exportData = 'Y';
break;
case 'publish':
this.appData[cbindex].publish = 'Y';
break;
}
console.log('option checked is '+ operation);
}
else{
switch(operation)
{
case 'create':
this.appData[cbindex].create = 'N';
break;
case 'read':
this.appData[cbindex].read = 'N';
break;
case 'exportFile':
this.appData[cbindex].exportFile = 'N';
break;
case 'exportData':
this.appData[cbindex].exportData = 'N';
break;
case 'publish':
this.appData[cbindex].publish = 'N';
break;
}
console.log('option unchecked is '+ operation);
}
}
I have some data in database with value of "Yes" and "No". When i checked need to send yes value and when unchecked send no. Please any write function for that. and I need to compare same in to database also. Please help me on this. Thanks in advance.