Angular Material — Tables with Sorting, Filtering, and Pagination
4 min readJan 22, 2021
Angular Material is a popular UI framework based on Material Design for Angular.
In this article, we’ll look at how to use Angular Material into our Angular project.
Table with Filtering
We can add an input box to let us search the table.
For example, we can write:
app.component.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatTableModule } from '@angular/material/table';
import { MatInputModule } from '@angular/material/input';@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
MatTableModule,
MatInputModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
styles.css
table {
width: 100%;
}
app.component.ts
import { Component } from '@angular/core';
import {…