- First create a new Angular project using ng new command
- Add Angular material to the project using command
- Official Documentation : https://material.angular.io/components/categories
ng add @angular/material
- Select the theme indigo pink
- Say yes to HammerJS
- Say yes to browser animation of Angular Material
To test if the Angular material is added properly we add a angular button component and test it.
app.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MatButtonModule} from '@angular/material'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, BrowserAnimationsModule, MatButtonModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
app.component.html
<button mat-raised-button>Hello World</button>