升级到 Angular Material 5 [英] Upgrading to 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.
谢谢!
推荐答案
你需要做的是:
- 由于
MaterialModule
已被删除,您必须将应用程序所需的模块分别导入到另一个模块(例如MyMaterialModule
并确保它在BrowserModule
)、const
,或在BrowserModule
之后单独添加模块.有关详细信息,请访问 文档. md
选择器已被移除并替换为mat
(以及类).要更新,请从npm
安装material-prefix-updater
:
- Since
MaterialModule
has been removed, you have to import the modules required for your application separately to either another module (such asMyMaterialModule
and making sure that it is afterBrowserModule
), aconst
, or adding the modules individually afterBrowserModule
. For more info, visit the docs. The
md
selectors have been removed and replaced withmat
(as well as classes). To update, installmaterial-prefix-updater
fromnpm
:
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屋!