【发布时间】:2020-12-05 22:21:23
【问题描述】:
我最近开始学习 Angular 和 Angular Material,但我想不出一种方法来为 mat-chip-list 的扩展输入字段添加滚动条。我的输入字段是可编辑的,同时还使用自动完成列表来填充数据。我尝试过类似的答案,要求您编辑 CSS,但没有一个对我有用。我需要芯片以水平滚动显示在一行中。现在,输入字段的大小刚刚增加以容纳芯片。
我的代码sn-p:
<!--Keyword section-->
<mat-form-field class="ranking-chip-list">
<mat-chip-list #chipList>
<mat-chip *ngFor="let keyword of keywords" [selectable]="selectable" [removable]="removable"
(removed)="remove(keyword)">
{{keyword}}
<mat-icon matChipRemove *ngIf="removable">cancel</mat-icon>
</mat-chip>
<input placeholder="Type your keywords to sort resumes..." #keywordInput [formControl]="keywordCtrl"
[matAutocomplete]="auto" [matChipInputFor]="chipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes" (matChipInputTokenEnd)="add($event)" />
</mat-chip-list>
<mat-autocomplete #auto="matAutocomplete" (optionSelected)="selected($event)">
<mat-option *ngFor="let keyword of filteredKeywords | async" [value]="keyword">
{{keyword}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
<!--Keyword section ends-->
如果我也应该链接 TypeScript 代码,请告诉我。
【问题讨论】:
标签: angular scroll angular-material