ng add @angular/material
自定义预构建主题
? Choose a prebuilt theme name, or "custom" for a custom theme: Custom ? Set up global Angular Material typography styles? Yes ? Set up browser animations for Angular Material? Yes
创建mat.module
ng g module mat
写个例子
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { MatButtonModule } from '@angular/material/button'; @NgModule({ declarations: [], imports: [ CommonModule, MatButtonModule ], exports:[ MatButtonModule ] }) export class MatModule { }