Solved – Angular Material Property ‘paginator’ has no initializer and is not definitely assigned in the constructor

Solved - Angular Material Property 'paginator' has no initializer and is not definitely assigned in the constructor

Hello guys how are you? Welcome back to my blog therichpost.com. Today in this blog post, I am going to tell you how to Solved – Angular Material Property ‘paginator’ has no initializer and is not definitely assigned in the constructor issue?

Property 'paginator' has no initializer and is not definitely assigned in the constructor
Property ‘paginator’ has no initializer and is not definitely assigned in the constructor

Guys I got this error during code implementing Material Datatable into my Angular 13 Application and using below code snippet and add that inside our component.ts file and we can solved that issue.

@ViewChild(MatPaginator) paginator :any = MatPaginator;

Angular 13 came and if you are new then you must check below two links:

  1. Angular 13 Demos
  2. AngularMaterial

I will appreciate that if you will tell your views for this post. Nothing matters if your views will be good or bad because with your views, I will make my next posts more good and helpful.

Jassa

Thanks

Comments

4 responses to “Solved – Angular Material Property ‘paginator’ has no initializer and is not definitely assigned in the constructor”

  1. Manoj Avatar
    Manoj

    Its Working fine fore me. Thank you

  2. Ajay Malhotra Avatar

    Awesome great to hear that.

  3. ailtonbsj Avatar
    ailtonbsj

    I do this to solve:

    @ViewChild(MatSort) sort: MatSort = {};
    @ViewChild(MatPaginator) paginator: MatPaginator = {};

    This way also works:

    @ViewChild(MatSort) sort: MatSort | null = null;
    @ViewChild(MatPaginator) paginator: MatPaginator | null = null;