要实现Angular中的多选下拉框(Multi-Select Dropdown),你可以使用ng-multiselect-dropdown库。以下是一个示例代码:
npm install ng-multiselect-dropdown
import { NgModule } from '@angular/core';
import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown';
@NgModule({
  imports: [
    NgMultiSelectDropDownModule.forRoot()
  ],
  // ...
})
export class YourModule { }
import { Component } from '@angular/core';
@Component({
  selector: 'your-component',
  templateUrl: './your.component.html',
  styleUrls: ['./your.component.css']
})
export class YourComponent {
  dropdownList = [];
  selectedItems = [];
  dropdownSettings = {};
  constructor() {
    this.dropdownList = [
      { id: 1, name: 'Option 1' },
      { id: 2, name: 'Option 2' },
      { id: 3, name: 'Option 3' },
      // ...
    ];
    this.dropdownSettings = {
      singleSelection: false,
      idField: 'id',
      textField: 'name',
      selectAllText: 'Select All',
      unSelectAllText: 'Unselect All',
      itemsShowLimit: 3,
      allowSearchFilter: true
    };
  }
}
 
通过以上代码,你就可以在Angular中实现一个多选下拉框,并通过idField属性来指定选项的ID字段。