Skip to content
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

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

Closed
ktersius opened this issue May 26, 2017 · 9 comments
Closed

Comments

@ktersius
Copy link

ktersius commented May 26, 2017

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

@hecof
Copy link

hecof commented May 28, 2017

Same behavior:

    <div style="display:flex; flex-direction: column;" *ngIf="_showProcess">
        <md-input-container>
          <input mdInput placeholder="Module">
        </md-input-container>
        <div>
          <button md-raised-button color="primary" (click)="_process($event)">Process</button>
        </div>
    </div>

@YeomansIII
Copy link
Contributor

Same issue here.
This is only occurring when using OnPush change detection strategy. Fields are populating but the placeholder is not moving up.

screen shot 2017-05-30 at 13 40 34

  editProfile() {
    this.editData = {};
    this.editData.name = this.user.name;
    this.editData.username = this.user.username;
    this.editData.website = this.user.website;
    this.editData.biography = this.user.biography;
    this.editingProfile = true;
    this.ChangeDetectorRef.markForCheck();
  }

@willshowell
Copy link
Contributor

Seems like a dupe of #3005?

@YeomansIII
Copy link
Contributor

@willshowell Looks like it, thanks. Hopefully we can get some progress, that has been open since February.

@mmalerba
Copy link
Contributor

Closing as dupe

@ktersius
Copy link
Author

ktersius commented Jun 1, 2017

@mmalerba Hi this occurs on Default strategy as well. Is it still a dupe?

@Component({
  selector: 'client-info',
  templateUrl: 'client-info.component.html',
  styleUrls: ['client-info.component.scss'],
  changeDetection: ChangeDetectionStrategy.Default
})

@willshowell
Copy link
Contributor

@ktersius do you mind reproducing in a plunker?

@ktersius
Copy link
Author

ktersius commented Jun 1, 2017

@willshowell I've changed those forms to model based forms and I'm not experiencing the issue any longer.

@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 5, 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

5 participants