In Angular How to Load the radio button value when i click on edit form button.
This is my UI.
when i click on save the data is inserted into the data Table. But when i click on edit button the form is not loading with the radio button values and when i click on Update button the data should be affected into the Data table.
app.component.html
<div class="col-sm-10">
<input type="radio" name="gender" [(ngModel)]="model.gender" value="male" checked> Male
<input type="radio" name="gender" [(ngModel)]="model.gender" value="female"> Female<br>
</div>
<button type="submit" class="btn btn-default" (click)="addEmployee()">Save</button>
<a class="btn btn-success" (click)="editEmployee(i)">Edit</a>
<button type="submit" class="btn btn-default" (click)="updateEmployee()">Update</button>
this is my app.component.ts
myValue;
editEmployee(k){
this.model2.name = this.employees[k].name;
this.model2.DOB=this.employees[k].DOB;
this.model2.mob = this.employees[k].mob;
this.myValue = k;
}
updateEmployee(){
let k= this.myValue;
for(let i=0; i<this.employees.length;i++){
if(i==k){
this.employees[i]= this.model2;
this.model2 = {};
this.msg = "Record is successfully updated..... ";
}
}
}
