Because the NX workspace in most cases has an angular.json
we can install an Angular Material library using the Angular CLI:
ng add @angular/material
The result will be the following:
roman@Romans-MacBook-Pro-2 some-project % ng add @angular/material
ℹ Using package manager: npm
✔ Found compatible package version: @angular/material@12.2.5.
✔ Package information loaded.
The package @angular/material@12.2.5 will be installed and executed.
Would you like to proceed? Yes
✔ Package successfully installed.
? Choose a prebuilt theme name, or "custom" for a custom theme: Indigo/Pink [ Preview: https://material.angular.io?theme=in
digo-pink ]
? Set up global Angular Material typography styles? Yes
? Set up browser animations for Angular Material? No
UPDATE package.json (2073 bytes)
✔ Packages installed successfully.
Your project is not using the default builders for "test". This means that we cannot add the configured theme to the "test" target.
UPDATE apps/some-project-chat/src/app/app.module.ts (472 bytes)
UPDATE angular.json (6739 bytes)
UPDATE apps/some-project-chat/src/index.html (621 bytes)
UPDATE apps/some-project-chat/src/styles.scss (181 bytes)