Template Parse Error: 'mat-sidenav-container' is not a known element

Angular 9 implementation

import { MatSidenavModule } from '@angular/material/sidenav';

imports: [MatSidenavModule]

You need to import import { MaterialModule } from './material.module'; in app.module.ts

imports: [    
    MaterialModule 
  ]

Since material module has been depreciated, With Angular latest version you need to use

import { MatSidenavModule } from '@angular/material/sidenav';

The answer from Sajeetharan was not working with newer versions of angular material.

From here:

MaterialModule was deprecated in version 2.0.0-beta.3 and it was removed completely in version 2.0.0-beta.11...

So, to fix the issue :

On post 2.0.0-beta.3:

import {
  MatSidenavModule,
} from '@angular/material';

@NgModule({
  exports: [MatSidenavModule],
  imports: [
    MatSidenavModule
  ],
})

And in older versions:

@NgModule({
  imports: [
    MaterialModule
  ],
})

Tags:

Angular