【发布时间】:2019-03-03 13:13:26
【问题描述】:
对 Angular 来说有点陌生,我花了大约一周的时间阅读文档,但我仍然无法解决这个问题。如果我们有如下代码所示的 Angular Material 芯片列表
<input type="text" name="fname" size=35>
<p></p>
<mat-chip-list>
<mat-chip *ngFor="let dt of chips">{{dt}}</mat-chip>
<mat-chip >One fish</mat-chip>
<mat-chip>Two fish</mat-chip>
<mat-chip >Primary fish</mat-chip>
<mat-chip >Accent fish</mat-chip>
</mat-chip-list>
当我单击一个标签以将该标签添加到输入框以便用标签组合制定查询时,我该如何做到这一点?感谢并感谢您的任何帮助。
【问题讨论】:
-
见材料团队的示例代码:stackblitz.com/angular/…
-
不完全。我以前见过。我在想从预定义列表中选择标签后,标签将被添加到输入框中。我似乎找不到类似的例子。