升级到角材料5 [英] Upgrading to Angular Material 5

查看:63
本文介绍了升级到角材料5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用的是Angular Material beta 8.此后从未更新过.现在v5可用了,我们想这样做.这样做时我应该考虑哪些事项?任何信息或指向它的方法都会很有帮助.

I am using a beta 8 of Angular Material in my project. It was never been updated since then. Now that v5 is available, we'd like to do so. What things should I consider while doing so? Any information or pointer to it would be really helpful.

谢谢!

推荐答案

您需要执行的操作如下:

What you have to do is the following:

  1. 由于已删除MaterialModule,因此必须将应用程序所需的模块分别导入到另一个模块(例如MyMaterialModule,并确保它在BrowserModule之后),const或在BrowserModule之后分别添加模块.有关更多信息,请访问文档.
  2. md选择器已被删除,并由mat(以及类)替换.要更新,请从npm安装material-prefix-updater:

  1. Since MaterialModule has been removed, you have to import the modules required for your application separately to either another module (such as MyMaterialModule and making sure that it is after BrowserModule), a const, or adding the modules individually after BrowserModule. For more info, visit the docs.
  2. The md selectors have been removed and replaced with mat (as well as classes). To update, install material-prefix-updater from npm:

npm i -g angular-material-prefix-updater

在npm全局安装后,在应用程序的根目录(其中-p参数是应用程序的tsconfig.json)上运行此命令:

After npm has installed it globally, run this command on your app's root directory (where the -p parameter is the app's tsconfig.json):

mat-switcher -p src/app/tsconfig.json # Or wherever tsconfig.json is

有关更多信息,请访问源代码或使用--help参数.

For more info, visit the source code or use the --help parameter.

注意:您不再需要指定MATERIAL_COMPATIBILITY_MODE.

这篇关于升级到角材料5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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