These are chat archives for angular/material

21st
Dec 2017
Rumes Shyaman
@rumes
Dec 21 2017 16:06
Hey I'm tryng to use mat input but gettin error Cannot read property 'error' of undefined
my html is
<form class="example-form" [formGroup]="loginForm">
  <mat-form-field class="example-full-width">
    <input matInput placeholder="User Name" [formControl]="username" >
    <mat-error *ngIf="username.error.email && !username.error.required">
      Please enter a valid email address
    </mat-error>
    <mat-error *ngIf="username.error.required">
      Email is <strong>required</strong>
    </mat-error>
  </mat-form-field>

  <mat-form-field class="example-full-width">
    <input matInput placeholder="Password" [formControl]="password" >
    <mat-error *ngIf="password.error.minLength && !password.error.required">
      Please enter a valid email address
    </mat-error>
    <mat-error *ngIf="password.error.required">
      Email is <strong>required</strong>
    </mat-error>
  </mat-form-field>

</form>
what wrong with my code?.
naren143
@naren143
Dec 21 2017 16:08
Hi can we have custom attribute for mat-options
Constantin
@costea93
Dec 21 2017 17:20
@rumes show also how you created the form controls in ts components