角材料-MdInput到MatInputModule吗? [英] Angular Material - MdInput to MatInputModule?
问题描述
我正在使用什么
- 角度
- 角材料^ 2.0.0-beta.12
我在做什么
-
我刚刚开始一个新项目并安装了材料
I just started a new project and installed material
从先前的项目复制某些语法时,尝试导入时出现错误
When copying some syntax from a previous project, I get an error when trying to import
'从'@ angular/material'导入{MdInputModule};
'import { MdInputModule} from '@angular/material';
- 在仔细检查了输入内容之后,现在好像已更改为"MatInputModule"
- 我已经更新了模块以使用"MatInputModule"
- 现在HTML引发错误
- 这是使用材料网站提供的语法
"md-form-field"不是已知元素:
'md-form-field' is not a known element:
HTML
<form [formGroup]="albumEdit">
<md-form-field>
<input mdInput formControlName="albumTitle" placeholder="Album Title">
</md-form-field>
</form>
问题
- 我在这里想念一些明显的东西吗?
- 在最新版本中实现材料组件的最佳方法是什么?
- 我缺少一些官方文档吗?
推荐答案
自2.0.0-beta.12
以来,Md
前缀已被删除,取而代之的是Mat
前缀.参见 CHANGELOG :
Since 2.0.0-beta.12
, Md
prefix has been removed in favor of Mat
prefix. See this CHANGELOG:
重大更改 所有"md"前缀均已删除.将
md
前缀更改为mat
:
Breaking Changes All "md" prefixes have been removed.Change
md
prefix tomat
:
在您的打字稿中,
import { MatInputModule} from '@angular/material';
并在您的模板中:
<mat-form-field>
<input matInput formControlName="albumTitle" placeholder="Album Title">
</mat-form-field>
该网站上的文档已过时,需要使用mat
前缀进行更新.
The documentation on the website is outdated and needs to be update with mat
prefix.
这篇关于角材料-MdInput到MatInputModule吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!