角材料-MdInput到MatInputModule吗? [英] Angular Material - MdInput to MatInputModule?

查看:79
本文介绍了角材料-MdInput到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> 

      问题

      1. 我在这里想念一些明显的东西吗?
      2. 在最新版本中实现材料组件的最佳方法是什么?
      3. 我缺少一些官方文档吗?

      推荐答案

      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 to mat:

      在您的打字稿中,

      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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆