'nz-alert' is not a known element

100 Views Asked by At

'nz-alert' is not a known element:

  1. If 'nz-alert' is an Angular component, then verify that it is part of this module.
  2. If 'nz-alert' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message

enter image description here

I just opened an Angular project using VSCode, and after loading the dependencies, the project runs successfully without any errors. However, I am getting error prompts in the editor. How should I handle this situation?

Some of the online solutions I found did not work after trying them. I know it's not a code issue; it's likely a configuration problem with VSCode regarding Angular.

1

There are 1 best solutions below

0
Naren Murali On

Please make sure to import nzAlertModule wherever your component is declared, either in its declared module imports or if its standalone, then inside the component decorator imports array.

import { NzAlertModule } from 'ng-zorro-antd/alert';

documentation nzAlert