我在使用ngx-avatar时面临这些错误
未知错误:模板解析错误:
'ngx-avatar' is not a known element:
1. If 'ngx-avatar' is an Angular component, then verify that it is part of this module.
2. If 'ngx-avatar' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.(“
[ERROR ->]<ngx-avatar name="John Doe"></ngx-avatar>"):
ng:///CardDetailsModule/CardDetailsComponent.html@118:6
at syntaxError (compiler.js:2175)
at TemplateParser.parse (compiler.js:11388)
at JitCompiler._parseTemplate (compiler.js:25963)
at JitCompiler._compileTemplate (compiler.js:25951)
at compiler.js:25895
at Set.forEach (<anonymous>)
at JitCompiler._compileComponents (compiler.js:25895)
at compiler.js:25808
at Object.then (compiler.js:2166)
at JitCompiler._compileModuleAndComponents (compiler.js:25807)我把这些都包括在app.module.ts里了
import { AvatarModule } from 'ngx-avatar';。。。
imports: [...,AvatarModule]我已经在全球安装了ngx,但它仍然不起作用。
发布于 2020-05-11 06:48:37
我认为你的项目中有两个模块
应用程序Module
cardsDetailComponent中使用了ngx-化身,属于CardDetails模块.但是你已经在 app.module引进了ngx。
如果您跨多个模块使用ngx,请尝试导入cardDetails.module和check.Suppose中的ngx模块,这意味着将其移动到共享模块,并在需要时将其导入模块。
一旦将ngx导入到cardDetails.module,请确保从app.module中删除它。
https://stackoverflow.com/questions/61722818
复制相似问题