Ser*_*i R 5 material-design angular-material2
我需要创建不带浮点标签的选择字段,但我想拥有占位符和默认值。
我阅读了文档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>
Run Code Online (Sandbox Code Playgroud)
而且无论如何,我都会得到浮动标签。那我做错了吗?
| 归档时间: |
|
| 查看次数: |
1291 次 |
| 最近记录: |