Skip to content

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

Closed
@atul221282

Description

@atul221282

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions