import { Component, OnInit, Input, ViewChild } from '@angular/core'; import { Note } from '../../models/note'; import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material'; @Component({ selector: 'app-notes', templateUrl: './notes.component.html', styleUrls: ['./notes.component.scss'] }) export class NotesComponent implements OnInit { @Input() notes: Note[]; displayedColumns: string[] = ['position', 'title', 'date']; dataSource :MatTableDataSource; @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; constructor() { } ngOnInit() { this.dataSource = new MatTableDataSource(this.notes); this.dataSource.paginator = this.paginator; } applyFilter(filterValue: string) { this.dataSource.filter = filterValue.trim().toLowerCase(); } }