"mat-form-field" 和 "mat-input-container" 有什么区别

What is the difference between "mat-form-field" and "mat-input-container"

我在表单中创建了这个字段:

<mat-form-field class="example-full-width">
  <mat-input-container floatPlaceholder="auto" flex="100">
    <input matInput [(ngModel)]="evento.email" name="email" type="email" placeholder="Email para Contatos" email required [errorStateMatcher]="formMatcher">
  </mat-input-container>
  <mat-hint>Este será o endereço de e-mail oficial do evento.</mat-hint>
  <mat-error *ngIf="formControl.hasError('email') && !formControl.hasError('required')">
    Por favor insira um e-mail com formato válido.
  </mat-error>
  <mat-error *ngIf="formControl.hasError('required')">
    Este campo é <strong>obrigatório.</strong> Não esqueça de preenchê-lo.
  </mat-error>
</mat-form-field>

如果我同时使用mat-form-fieldmat-input-container,我会在输入框上方得到2个重复的标签和2行。

我只能使用其中一个,但我应该使用哪个?为了做出那个决定,我需要知道什么时候最好使用每一个。谁能帮忙解释一下?我在 http://material.angular.io

中找不到它

该组件已从 mat-input-container 重命名为 mat-form-field(我认为是在 v2.0.0 测试版期间),但旧的选择器在 v5.x 中仍然受支持。在 v6.x 中,不再支持 mat-input-container。所以你应该使用新名称 mat-form-field.