角度材料 - MdInput 到 MatInputModule?

Meg*_*ron 5 angular-material angular-material2 angular

我在用什么

  • 角材料 ^2.0.0-beta.12

我在做什么

  • 我刚刚开始了一个新项目并安装了材料

  • 从以前的项目复制某些语法时,尝试导入时出现错误

'从'@angular/material'导入{MdInputModule};

  • 在深入研究打字后,它看起来好像现在已更改为“MatInputModule”
  • 我已经更新了我的模块以使用“MatInputModule”
  • 现在 HTML 抛出错误

'md-form-field' 不是已知元素:

  • 这是使用材料网站提供的语法

HTML

<form [formGroup]="albumEdit">
  <md-form-field>
    <input mdInput formControlName="albumTitle" placeholder="Album Title">
  </md-form-field>
</form> 
Run Code Online (Sandbox Code Playgroud)

问题

  1. 我在这里遗漏了一些明显的东西吗?
  2. 在最新版本中实现材料组件的最佳方法是什么?
  3. 是否有一些我遗漏的官方文件?

Fai*_*sal 6

自 以来2.0.0-beta.12Md前缀已被删除以支持Mat前缀。请参阅此变更日志

重大更改 所有“md”前缀都已删除。将md前缀更改为mat

在你的打字稿中,

import { MatInputModule} from '@angular/material';
Run Code Online (Sandbox Code Playgroud)

在你的模板中:

<mat-form-field>
    <input matInput formControlName="albumTitle" placeholder="Album Title">
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)

网站上的文档已过时,需要使用mat前缀进行更新。