升级到 Angular Material 5 [英] Upgrading to Angular Material 5

查看:24
本文介绍了升级到 Angular Material 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.

谢谢!

推荐答案

你需要做的是:

  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.

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

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