Getting Error "Mat-Nav-List Is Not a Known Element"

Getting error "mat-nav-list is not a known element" , used @angular/material" version "^5.2.5"

1

5 Answers

None of above worked for me. I had to include 'MatListModule' and it worked.

3

Make sure you have imported MatListModule and declared it in your imports in the App.Component module. It works for me

  1. Make sure that the component is loading well in the browser, without any imports yet.

  2. Now follow the implementation as per Docs presented on

If you're confused by the documentation, here's what you should do -

Head to the module of the component and add the following

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

and

imports: [
   // Other imports
   MatSidenavModule
],

Then you can write the HTML code. The Nav should work well.

That's it!

Please let me know if the error persists

In order to overcome the error

<mat-nav-list>

tag is not known as an element, we need to import MatListModule along with MatSidenavModule as

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

It may still help someone I forgot to declare the Component where I use the 'mat-nav-list' in the app-module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest