我的Angular7应用程序中有一个HTML,在该应用程序中,每行显示相同的下拉列表。选择一个下拉列表会更改另一个下拉列表的值。如何使所选内容对该特定下拉列表唯一。
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>
部件代码
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';
},
() => {
});
}