MdInput - Placeholder does not float when using formControl setValue()
Bug, feature request, or proposal:
Bug
What is the expected behavior?
Placeholder should be floating over input when setting the input value using setValue of its formControl.
What is the current behavior?
When I use setValue, the input contains the value set and the placeholder overlays the value, without floating over it. If I enter a text manually just after using setValue, the placeholder goes to the right place.
What are the steps to reproduce?
Here's a plunker that reproduces the issue: http://plnkr.co/edit/huUsxFmbFKSZuCG92EmQ?p=preview
Which versions of Angular, Material, OS, browsers are affected?
Angular: 2.3.1 material: git+https://github.com/angular/material2-builds.git but also tested on 2.0.0-beta1 Browser: Chromium 55.0.2883.87 Os: Chromium 55.0.2883.87
Ha! I just came across this bug too!
In the meantime, if you are only experiencing this because the initial setting of the values is async then you could provide "dummy values" to the form controls when you create them, so that the input directive thinks that they are not empty before the setValue finally fills them.
@brunopereira27 is your plunkr working ? Because I was trying to see your issue but I have that :

So I don't see any problem.
I'm having (probably) the same problem :

But as your Plunkr seems to be working I'm not sure.
I'm using reactive form and patchValue tho.
Hi .. this still an issue in beta.10.. shouldnt be open?
Thanks @petebacondarwin , the workaround works! I used just a space in the string and now it loads with the initial value and correct placeholder
city: [' ', [<any>Validators.required, <any>Validators.minLength(5)]],
https://github.com/angular/material2/issues/2613#issuecomment-325980984
Should definitely be reopen ;)
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.