简体   繁体   中英

vscode complains about unknown element (mat-toolbar)

I'm creating an angular application using Nwrl/nx. I have a library mobile that consists of 3 components: main, topnav, and sidenav. Each of these components makes use of different Angular Material modules. My directory structure looks like this.

📦lib
 ┣ 📂main
 ┃ ┣ 📜main.component.html
 ┃ ┣ 📜main.component.scss
 ┃ ┣ 📜main.component.spec.ts
 ┃ ┗ 📜main.component.ts
 ┣ 📂sidenav
 ┃ ┣ 📜sidenav.component.html
 ┃ ┣ 📜sidenav.component.scss
 ┃ ┣ 📜sidenav.component.spec.ts
 ┃ ┗ 📜sidenav.component.ts
 ┣ 📂topnav
 ┃ ┣ 📜topnav.component.html
 ┃ ┣ 📜topnav.component.scss
 ┃ ┣ 📜topnav.component.spec.ts
 ┃ ┗ 📜topnav.component.ts
 ┗ 📜<library>.module.ts

In the libary module I am importing another module that has imported/exported the Angular Material modules that I use throughout my application. My application compiles and runs just fine.

However, in VSCode, I'm getting warning indicators in the sidenav.component.html file, and only in this component, indicating that none of my angular material elements are known. I can use these same elements in Main and Sidenav and I do not see the VSCode warnings.

I don't understand why I'm seeing these warnings in just one of the components in the module, but not the other two. I tried using the CUSTOM_ELEMENTS_SCHEMA but that did not suppress the warnings from VS Code (nor did I expect it too). Since the app works with no errors/warnings, this seems like a VSCode issue, or perhaps an Angular/Nwrl/VSCode issue? I'm new to Nwrl so this library concept is new to me.

Anyone else seen this?

Looks like this was a vscode quirk. When I restarted vscode, vscode stopped complaining.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM