components icon indicating copy to clipboard operation
components copied to clipboard

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

Open atul221282 opened this issue 9 years ago • 5 comments

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

atul221282 avatar Feb 15 '17 23:02 atul221282

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 avatar Feb 15 '17 23:02 kara

yeah looks good in master thanks for the prompt reply

atul221282 avatar Feb 16 '17 00:02 atul221282

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

ghost avatar Sep 09 '17 20:09 ghost

Same here with beta 10

s-f-a-g avatar Sep 28 '17 16:09 s-f-a-g

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.