【发布时间】:2018-09-11 00:58:13
【问题描述】:
我需要创建没有浮动标签的选择字段,但我想要占位符和默认值。
我阅读了文档https://material.angular.io/components/form-field/overview#floating-label 并尝试自己做。
<mat-form-field [floatLabel]="never">
<mat-select placeholder="All categories" [formControl]="catForm" multiple> //First opportunity for use placeholder
<mat-option *ngFor="let category of categories" [value]="category.name">
{{ category.name }}
</mat-option>
</mat-select>
<!-- <mat-placeholder>All categories</mat-placeholder> -->//Second opportunity for use placeholder
</mat-form-field>
无论如何我都会得到浮动标签。那是我做错了吗?
【问题讨论】:
标签: material-design angular-material2