Upgrading to Angular Material 5

限于喜欢 提交于 2019-12-24 19:07:57

问题


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.

Thanks!


回答1:


What you have to do is the following:

  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
    

    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
    

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

    Note: You no longer need to specify MATERIAL_COMPATIBILITY_MODE.



来源:https://stackoverflow.com/questions/47725503/upgrading-to-angular-material-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!