I am using checkbox in angular for selecting skillSet. But when any of checkbox is checked then it checked the all checkboxes. How to solve this?
Here is my skillSet in component.ts :-
skillSet: Array<string> = ['JAVA', 'SQL', 'J2EE', 'SPRING'];
Here is checkbox field in html :-
<div class="col-md-6">
<label for="skills">SkillSet</label><br>
<label class="ml-2 mt-1" *ngFor ="let skill of skillSet">
<input type="checkbox" [(ngModel)] = "employee.skills" name="skills" value="{{skill}}">
{{skill}}
</label>
</div>
Here is addEmployee.ts :-
export class Employee
{
employeeId : number;
firstName : string;
lastName : string;
age : number;
gender : string;
salary : number;
department : string;
state : string;
city : string;
address : string;
email : string;
skills : Array<{ skillName: string }>;
}
I want to display skills json like this :-
"skills": [
{
"skillName": "JAVA"
},
{
"skillName": "J2EE"
}
]