首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“‘ngx avatar”不是已知的元素。

“‘ngx avatar”不是已知的元素。
EN

Stack Overflow用户
提问于 2020-05-11 05:22:52
回答 1查看 1.6K关注 0票数 0

我在使用ngx-avatar时面临这些错误

未知错误:模板解析错误:

代码语言:javascript
复制
'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.

(“

代码语言:javascript
复制
[ERROR ->]<ngx-avatar name="John Doe"></ngx-avatar>

"):

代码语言:javascript
复制
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里了

代码语言:javascript
复制
import { AvatarModule } from 'ngx-avatar';

。。。

代码语言:javascript
复制
imports: [...,AvatarModule]

我已经在全球安装了ngx,但它仍然不起作用。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-11 06:48:37

我认为你的项目中有两个模块

应用程序Module

  • CardDetails

cardsDetailComponent中使用了ngx-化身,属于CardDetails模块.但是你已经在 app.module引进了ngx。

如果您跨多个模块使用ngx,请尝试导入cardDetails.module和check.Suppose中的ngx模块,这意味着将其移动到共享模块,并在需要时将其导入模块。

一旦将ngx导入到cardDetails.module,请确保从app.module中删除它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61722818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档