I have an html in my angular 7 application where I am displaying the same dropdown for every row. Selecting one dropdown is changing the value for the other. How do I make the selection unique to that particular dropdown.
html
<div class="upload-table">
<table id="table1" class="center" >
<tbody class="upload-name-style">
<tr *ngFor="let item of files; let i=index">
<td> <input kendoTextBox [(ngModel)]="item.relativePath" style="width: 350px" /></td>
<td><kendo-dropdownlist style="width:350px" [(ngModel)]="selectedDocumentItem" [data]="DocumentTypes"
[filterable]="false" textField="Name" valueField="Id">
</kendo-dropdownlist></td>
</tr>
</tbody>
</table>
</div>
Component Code
DocumentTypes: any = {};
selectedDocumentItem: { 'Id': any; 'Name': any; };
public getDocumentTypes() {
this.documentUploadService.getDocumentTypes()
.subscribe(data => {
this.DocumentTypes = data;
this.DocumentTypesForDropDown = this.DocumentTypes.map(x => x.Name);
this.getDocumentUploadDetails();
this.setGridOptions();
this.setColumns();
},
err => {
this.Error = 'An error has occurred. Please contact BSG';
},
() => {
});
}