我正在使用带有Angular语言服务扩展的VS代码。VS代码经常错误地报告我的Angular HTML模板中的错误。我可以成功地运行Angular应用程序,成功地运行我的单元测试,并成功地构建应用程序,而不会看到VS Code报告的错误。我已经看到了多种类型的错误报告,但我最常看到的一种是下面的。我并不总是看到这些假阳性,但它确实经常发生。有什么办法可以解决这个问题吗?
'xyz' is not a known element:
1. If 'xyz' is an Angular component, then verify that it is part of this module.
2. If 'xyz' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
发布于 2021-08-10 10:40:29
可能是您错误地使用了component
的selector
。检查您的component
的selector
是否在html
文件中的某处被正确用作html
标签。
https://stackoverflow.com/questions/68731619
复制