Skip to content

md-input placeholder does not move up after model update / also after *ngIf #4814

Closed
@ktersius

Description

@ktersius

Running material beta 6 and ng 4.0.3, Chrome Version 58.0.3029.110 (64-bit)

I have two issues.

  1. After loading and setting the model in the promise .then() the input placeholders do not not move up. I can solve this by calling ChangeDetectorRef.detectChanges() after setting the model, which should not be needed correct? Or by interacting with the form.
 this.clientService.getClient(clientId)
        .then((client: any) => {
          this.client = new Client(client);
          // this.ref.detectChanges();
        });

md input issue 1

  1. I have a group box selection and if I toggle this, which causes elements to be shown or hidden the placeholders again fail to move up.

An html snippet of the template with the *ngIf

    <md-radio-group  fxFlex="0 1 auto" [(ngModel)]="client.type">
      <md-radio-button value="Personal">Personal</md-radio-button>
      <md-radio-button value="Business">Business</md-radio-button>
    </md-radio-group>

   <div fxFlex="50" fxFlex.lt-md="100">
      <md-input-container>
        <input mdInput [(ngModel)]="client.name" placeholder="Name" required>
      </md-input-container>
    </div>

    <div *ngIf="isPersonal()" fxFlex="50" fxFlex.lt-md="100">
      <md-input-container>
        <input mdInput [(ngModel)]="client.surname" placeholder="Surname" required>
      </md-input-container>
    </div>

md input issue 2

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