Components: floatLabel property of mat-form-field doesn't work

Created on 5 Feb 2018  路  5Comments  路  Source: angular/components

I use floatLabel property of mat-form-field, but it doesn't work.

<mat-form-field [floatLabel]='always'>
        <mat-label>CyberSource Reference</mat-label>
        <input matInput placeholder="(Enter reference)" />
 </mat-form-field>

It has 'CyberSource Reference' as placeholder. Then it move to label on focus. Behavior doesn't change with any value of floatLabel property. Any Ideas? MatFormFieldModule is loaded to my app. Thanks.

"@angular/material": "^5.0.4"

Most helpful comment

This is just a syntax error:

<mat-form-field floatLabel="always">

or

<mat-form-field [floatLabel]="'always'">

All 5 comments

This is just a syntax error:

<mat-form-field floatLabel="always">

or

<mat-form-field [floatLabel]="'always'">

Yes, it is true, thank you -_-

this` is my code.on focus it chages to lable.it is driving me crazy now. acn anyone plaese tell me what am i doing wrong?

<mat-form-field floatLabel="never" style="background: transparent;border: 0px"> <mat-select style="height: 30px;" (selectionChange)="add($event)"> <mat-option *ngFor="let smartGroup of smartGroups" [value]="smartGroup.groupId"> xyz </mat-option> </mat-select> <mat-label class="my-class-name">{{'select a group' |translate}}</mat-label> </mat-form-field>

You saved my hours. Thanks.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xtianus79 picture xtianus79  路  3Comments

kara picture kara  路  3Comments

Miiekeee picture Miiekeee  路  3Comments

savaryt picture savaryt  路  3Comments

constantinlucian picture constantinlucian  路  3Comments