angular - 迁移到 Angular 10 最新版本时出现错误
问题描述
我已将 Angular 应用程序迁移到最新的 Angular 10 版本。运行代码时出现如下错误:
src/app/app.module.ts:32:5 - 错误 NG6001:类 'DashboardComponent' 列在 NgModule 'AppModule' 的声明中,但不是指令、组件或管道。要么从 NgModule 的声明中删除它,要么添加适当的 Angular 装饰器。
src/app/dashboard/dashboard.component.ts:24:14
export class DashboardComponent implements OnInit {
~~~~~~~~~~~~~~~~~~
'DashboardComponent' is declared here.
app.module.ts
@NgModule({
declarations: [
AppComponent,
//routingComponents,
LoginComponent,
DashboardComponent,
UserComponent,
ForgotpasswordComponent
]
imports: [
BrowserModule,
AppRoutingModule,
FormsModule,
HttpClientModule,
MomentModule
],
providers: [UserService,AuthserviceService,DashboardService,WebsocketService,NotifyService],
bootstrap: [AppComponent]
})
该应用程序在以前的版本(角度 8)中运行良好,但是当迁移到角度 10 版本并在执行时显示上述错误,任何人都可以帮助我解决这个问题。
解决方案
推荐阅读
- python-3.x - 可选类型注释。检查是否为无后使用值?
- sql-server - 用存储过程替换 Getdate()
- python - Jupyter & Python:为什么孩子对父方法的调用不能识别父方法的导入?
- cefsharp - 我可以将cefsharp的背景设置为透明吗?
- python-3.x - 尝试“SDL_GetWindowID”时出现 Python 错误“预期 LP_SDL_Window”
- f# - CSV 类型提供程序和访问数据
- c# - 无法从 Discord.ActivityType 转换为 Discord.IActivity C# Discord.Net
- javascript - 找到 2 个具有非唯一 ID 的元素。仅加载选定的 div 以避免冲突
- python - 用于模糊图像的低通滤波器
- javascript - 防止 `document.execCommand("copy")` 替换 & 符号