Skip to content

md-input placeholder doesn't fade when loading formgroup value via promise from service #3117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
atul221282 opened this issue Feb 15, 2017 · 5 comments

Comments

@atul221282
Copy link

atul221282 commented Feb 15, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Placeholder from md-input to move up when setting formgroup from back-end api promise.

What is the current behavior?

md-input placeholder is still getting displayed behind the actual text and not moving up. I found the reason for this issue and it is md-empty class not getting removed from label in html produces by md-input-container directive

What are the steps to reproduce?

Create formgroup from FormBuilder api in angular2 set the value of formgroup from backend api or use setTimeout to mock it. Try setting the value like this as per angular docs this.myForm.controls["user"].setValue(this.user, { onlySelf: true });

Providing a Plunker (or similar) is the best way to get the team to see your issue.
http://stackoverflow.com/questions/42249684/md-input-placeholder-doesnt-fade-when-loading-formgroup-value-via-promise-from
Created plunker also
Plunker template: http://plnkr.co/edit/skGVKxNiDe0477OseE9D

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

angular 2.4.0
angular material 2.0.0-beta.1
OS - Windows10,
Browser - Chrome, IE Edge, IE11

Is there anything else we should know?

If I use ngModel instead of form group it works fine but when I use simple input(not angular material), with placeholder ngModel and formgroup both work fine
ky1bg

@kara
Copy link
Contributor

kara commented Feb 15, 2017

If you're using 2.0.0-beta.1, you are probably seeing the setValue issue that has since been fixed in master. Testing in plunker with the master build (rather than the material bundle from NPM), it seems to be working now: http://plnkr.co/edit/Z3AR9NqqD5cq8ymUF2ye?p=preview. As soon as we release, you should be able to upgrade to get the fix.

The exception is using setValue with an onPush change detection strategy, for which there is already an issue.

@kara kara closed this as completed Feb 15, 2017
@atul221282
Copy link
Author

yeah looks good in master thanks for the prompt reply

@teamtaheny1
Copy link

having this same issue in beta10. was working great in beta8.

@s-f-a-g
Copy link

s-f-a-g commented Sep 28, 2017

Same here with beta 10

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants