Я хочу выбрать несколько значений в угловых 6 через флажок.Здесь я выбираю отдел в раскрывающемся списке, сотрудники, связанные с отделом, перечислены в другом раскрывающемся списке с флажком.Это процесс, но на самом деле последнее значение массива отображается только в раскрывающемся списке, я использую ng-multiselect-dropdown для выбора нескольких значений
{
"content":[
{
"userid":6,
"firstName":"Anns Jarigo",
"lastName":"PaulRaj",
"jobTitle":"JAVA_DEVELOPER",
"position":"TEAM_MEMBER",
"mode_of_employement":"Direct",
"phoneNumber":"9087881162",
"date_of_joining":"24-02-2018",
"reportManager":"sampath.m@binary2quantum.com",
"image":"anns.jpg",
"userRole":"EMPLOYEE",
"appUser":6,
"department":"JAVA"
},
{
"userid":7,
"firstName":"Amanullah",
"lastName":"H",
"jobTitle":"JAVA_DEVELOPER",
"position":"TEAM_MEMBER",
"mode_of_employement":"Direct",
"phoneNumber":"9087881162",
"date_of_joining":"14-02-2018",
"reportManager":"sampath.m@binary2quantum.com",
"image":"aman.jpg",
"userRole":"EMPLOYEE",
"appUser":7,
"department":"JAVA"
},
{
"userid":8,
"firstName":"Raj Prabhu",
"lastName":"A",
"jobTitle":"JAVA_DEVELOPER",
"position":"TEAM_MEMBER",
"mode_of_employement":"Direct",
"phoneNumber":"9087881162",
"date_of_joining":"26-07-2018",
"reportManager":"sampath.m@binary2quantum.com",
"image":"raj.jpg",
"userRole":"EMPLOYEE",
"appUser":8,
"department":"JAVA"
},
{
"userid":13,
"firstName":"Subashri",
"lastName":"P",
"jobTitle":"JAVA_TRAINEE",
"position":"INTERN",
"mode_of_employement":"Direct",
"phoneNumber":"9087881162",
"date_of_joining":"17-08-2018",
"reportManager":"sampath.m@binary2quantum.com",
"image":"subashri.jpg",
"userRole":"INTERN",
"appUser":13,
"department":"JAVA"
}
],
"status":"Success!"
}
Component.ts
getEmployees(deviceValue: String){
this.service.getEmployee(deviceValue).subscribe(response=>
{
this.employees=response.content;
for(let i = 0 ; i < this.employees.length; i++){
this.test= this.employees[i].firstName;
console.log(this.test+" test name")
this.testId = this.employees[i].userid;
this.dropdownList=[
{ item_id : this.testId , item_text: this.test}
]
}
this.dropdownSettings = {
singleSelection: false,
idField:'item_id',
textField: 'item_text',
selectAllText: 'Select All',
unSelectAllText: 'UnSelect All',
itemsShowLimit: 3,
allowSearchFilter: true
};
HTML:
<ng-multiselect-dropdown
[placeholder]="'custom placeholder'"
[data]="dropdownList"
[(ngModel)]="selectedItems"
[settings]="dropdownSettings"
(onSelect)="onItemSelect($event)"
(onSelectAll)="onSelectAll($event)"
>
</ng-multiselect-dropdown>
`