Automatically

In Angular 6, you can automatically add Angular Material to your project, saving a lot of time in the process:

  1. Execute the add command, as shown:
$ npx ng add @angular/materialInstalling packages for tooling via npm.+ @angular/material@6.0.1added 1 package in 15.644sInstalled packages for tooling via npm.UPDATE package.json (1381 bytes)UPDATE angular.json (3694 bytes)UPDATE src/app/app.module.ts (502 bytes)UPDATE src/index.html (474 bytes)UPDATE node_modules/@angular/material/prebuilt-themes/indigo-pink.css (56678 bytes)added 1 package in 13.031s

Note that the index.html file has been modified to add the icons library and the default font, as follows:

src/index.html<head> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" ...

Get Angular 6 for Enterprise-Ready Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.