mseemann / angular2-mdl-ext

Additional components for @angular-mdl/core that are not part of material design lite (npm: @angular-mdl/*)
MIT License
100 stars 42 forks source link

Floating label on select is not working #833

Open kleber-swf opened 7 years ago

kleber-swf commented 7 years ago

Maybe I'm doing something wrong, but this piece of code is not showing the floating label:

<mdl-select label="Unity" floating-label name="unity" [(ngModel)]="item.unity">
    <mdl-option *ngFor="let u of item.unities" [value]="u.id">{{u.name}}</mdl-option>
</mdl-select>

To make the floating label appear I have to put the placeholder and the class manually, like this:

<mdl-select label="Unity" placeholder="Unity" floating-label name="unity" class="mdl-textfield--floating-label" [(ngModel)]="item.unity">
    <mdl-option *ngFor="let u of item.unities" [value]="u.id">{{u.name}}</mdl-option>
</mdl-select>

Is that right? Am I missing something?

Thanks for the awesome component, btw 😃

Pomelool commented 7 years ago

I met the same issue.

kleber-swf commented 7 years ago

Yep. Two months and I'm having the same problem too, hahha. I'm using the workaround since then.

adasq commented 7 years ago

Hmm it seems to work for me. Do you guys see same issue here: http://mseemann.io/angular2-mdl-ext/select in example select provided by ngModel with floating label section?

samdbrice commented 7 years ago

Also not working for me. What's strange is that it worked fine then after modifying the template it stopped and I'm not sure at what point.

FYI, partial package list and versions below:

"@angular-mdl/core": "^4.0.8",
"@angular-mdl/popover": "^0.8.0",
"@angular-mdl/select": "^0.11.2",
"@angular/animations": "~4.4.4",
"@angular/common": "~4.4.4",
"@angular/compiler": "~4.4.4",
"@angular/core": "~4.4.4",
"@angular/flex-layout": "^2.0.0-beta.9",
"@angular/forms": "~4.4.4",
"@angular/http": "~4.4.4",
"@angular/platform-browser": "~4.4.4",
"@angular/platform-browser-dynamic": "~4.4.4",
"@angular/platform-server": "~4.4.4",
"@angular/router": "~4.4.4",
"@angularclass/hmr": "~2.1.3",
"@angularclass/hmr-loader": "^3.0.4",
"@angular/compiler-cli": "~4.4.4",