【问题标题】:Multiselct Dropdown in angular material2角度材料2中的多选下拉菜单
【发布时间】:2017-11-03 22:33:50
【问题描述】:

我在我的应用程序中使用了角度材料 (https://material.angular.io)。 我已经尝试使用芯片(mat-chip-list)在材料角度中使用多选下拉菜单。但我无法实现。有没有人使用角材料实现它?如果请分享链接或示例?

【问题讨论】:

标签: angular user-interface multi-select angular-material2


【解决方案1】:

Angular 材质已经可以做到这一点。只需将multiple[multiple]="true" 添加到您的mat-select

<mat-form-field>
  <mat-select multiple>
    <mat-option *ngFor="let option of options" [value]="option">
      {{ option }}
    </mat-option>
  </mat-select>
</mat-form-field>

StackBlitz Demo

【讨论】:

  • 嗨。我试过了。但是选择复选框中的值。我不需要复选框。这必须是正常的选择选项。一旦用户选择该选项,它必须出现在带有“x”的文本框中。如果我点击'x'。它应该关闭。在这个用户中也可以选择多个。所以只有我尝试过 mat-chip-list。有什么建议吗?
猜你喜欢
  • 2020-03-13
  • 2020-02-13
  • 2018-08-04
  • 1970-01-01
  • 1970-01-01
  • 2019-08-03
  • 2021-09-12
  • 2014-12-08
  • 1970-01-01
相关资源
最近更新 更多