I want to pass checkbox value as Y if it is checked and values as N if checkbox is uncheked. this is my checkbox code in html file
<div class="col-sm-12">
<label style="padding-left: 6px;">Status:</label>
<span style="padding-left: 10px;"></span>
<input type="checkbox"
formControlName="Status" style="margin-left: 10px;" [(ngModel)]="termDetails.Status"
[ngClass]="{ 'is-invalid': submitted && addTermForm.controls.Status.errors }">
<div *ngIf="submitted && addTermForm.controls.Status.errors" class="text-danger">
<div *ngIf="addTermForm.controls.Status.errors">
Status is required
</div>
</div>
</div>
this is my ts file validation
ngOnInit(): void {
this.termEditForm();
this.addTermForm = this.formBuilder.group({
RuleName: ['', [Validators.required, Validators.pattern('[a-zA-Z# ]*')]],
// Dealer_Id: ['', [Validators.required, Validators.pattern('[0-9]*')]],
Type: ['', [Validators.required]],
Status: ['', [Validators.required]],
});
}
Aucun commentaire:
Enregistrer un commentaire