angular - 使用库中声明的角度组件时出错
问题描述
我创建了一个带有一些常见组件和一个 2 角度应用程序的角度工作区,但是当我尝试在角度应用程序中使用它时,它给了我这个错误:
“错误 NG6002:出现在 AppModule 的 NgModule.imports 中,但无法解析为 NgModule 类。”
这是 app.module.ts:
import { FormControlComponent } from 'my-library';
...
imports: [
BrowserModule,
AppRoutingModule,
FormControlComponent,
],
我的图书馆有这个代码:
我的库.module.ts
declarations: [
...
FormControlComponent,
...
],
exports: [
...
FormControlComponent,
...
],
我的 public-api.ts 有这个代码:
export * from './lib/form-control/form-control.component';
我构建了库并添加到 package.json:
“我的图书馆”:“文件:dist/我的图书馆”,
解决方案
推荐阅读
- c# - 在等待任务完成时做某事
- vue.js - vuetify中如何防止canvas溢出卡并使其响应?
- r - 函数说参数丢失,但我已经把它放在函数中,为什么它说它丢失了?
- python - 无法定义所有变量
- python - TypeError: zeros_like(): 在 MLM 上微调时参数“输入”
- windows - 监视 Windows 文件夹中添加的 PDF 文件
- oracle - 联合查询 - 为每个查询强制哈希唯一
- html - 在 HTML 网页中放置在线流
- javascript - 如何从 URL 获取 JSON 字符串?
- node.js - Mongodb 复合索引 vs 多个集合