📅  最后修改于: 2023-12-03 14:44:35.016000             🧑  作者: Mango
ng add @angular/material
- Shell/Bashng add @angular/material
is a command used by developers to easily add Angular Material to their projects. This command will install the necessary packages and configure the project to use Angular Material with minimal setup required.
To use ng add @angular/material
, open a command prompt or terminal and navigate to the root directory of your Angular project. Once there, simply type the following command:
ng add @angular/material
This will initiate the installation process and configure your project to use Angular Material.
ng add @angular/material
Do?ng add @angular/material
performs several steps to add Angular Material to your project:
@angular/material
and @angular/cdk
packages along with their dependencies.@angular/material-icons
.styles.scss
file to include the Material theme and typography.app.module.ts
file to enable Material components.Once the installation is complete, you can start using Angular Material components in your project.
ng add @angular/material
also provides some additional options that you can use:
--theme
: This allows you to choose a pre-built Material theme for your project.--hammerjs
: This enables support for touch gestures in Material components by adding HammerJS to your project.Example:
ng add @angular/material --theme=indigo-pink --hammerjs
By using ng add @angular/material
, Angular developers can easily add Material Design to their projects without much effort. This command simplifies the installation process and eliminates the need for manual configuration.