Abhi
Abhi

Reputation: 1671

Upgrading to Angular Material 5

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!

Upvotes: 0

Views: 1030

Answers (1)

Edric
Edric

Reputation: 26700

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.

Upvotes: 3

Related Questions